state.gd 534 B

12345678910111213141516171819202122232425262728
  1. extends Node
  2. # Base interface for all states: it doesn't do anything by itself,
  3. # but forces us to pass the right arguments to the methods below
  4. # and makes sure every State object had all of these methods.
  5. # warning-ignore:unused_signal
  6. signal finished(next_state_name)
  7. # Initialize the state. E.g. change the animation.
  8. func enter():
  9. pass
  10. # Clean up the state. Reinitialize values like a timer.
  11. func exit():
  12. pass
  13. func handle_input(_event):
  14. pass
  15. func update(_delta):
  16. pass
  17. func _on_animation_finished(_anim_name):
  18. pass