21 lines
478 B
GDScript
21 lines
478 B
GDScript
class_name PlayerThrowState
|
|
extends PlayerState
|
|
|
|
var is_animation_finished = false
|
|
|
|
func enter(_msg := {}):
|
|
player.animation_player.speed_scale = 0.8
|
|
player.animation_player.play("throw")
|
|
player.hit.emit()
|
|
|
|
func update(_delta: float):
|
|
if is_animation_finished:
|
|
state_machine.transition_to("Idle")
|
|
|
|
func exit():
|
|
is_animation_finished = false
|
|
player.animation_player.speed_scale = 1
|
|
|
|
func _on_animation_player_animation_finished(_anim_name):
|
|
is_animation_finished = true
|