Files
godot-demo-projects/2d/finite_state_machine/player/states/die.gd
Yaxian 1d8fa9c44d Add player_state dictionary to manage player state names for FSM demo (#1143)
* Add player_state dictionary to manage player state names for FSM demo

* Use a constant typed Dictionary of StringNames and update to Godot 4.5

---------

Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
2025-10-01 21:33:27 -07:00

11 lines
287 B
GDScript

extends "res://player/player_state.gd"
# Initialize the state. E.g. change the animation.
func enter() -> void:
owner.set_dead(true)
owner.get_node(^"AnimationPlayer").play(PLAYER_STATE.die)
func _on_animation_finished(_anim_name: String) -> void:
finished.emit(PLAYER_STATE.dead)