Files
godot-demo-projects/2d/finite_state_machine/player/states/die.gd
Nathan Lovato 1ef5373c4f Rewrite FSM demo to respect the single responsibility principle
Now there's a base state_machine script, the StateMachine is separate from the physics body.
I reworked the code to follow the GDscript guidelines in the official manual.
2018-06-22 15:16:20 +09:00

11 lines
248 B
GDScript

extends "res://state_machine/state.gd"
# Initialize the state. E.g. change the animation
func enter():
owner.set_dead(true)
owner.get_node("AnimationPlayer").play("die")
func _on_animation_finished(anim_name):
emit_signal("finished", "dead")