Reworked idle, lookaround and death to the states

This commit is contained in:
2026-02-01 23:51:37 +03:00
parent 37b5b698a6
commit 81d81ae103
16 changed files with 153 additions and 19 deletions
@@ -0,0 +1,21 @@
extends PlayerState
const ANIMATION_LOOK_AROUND_1 = "look_around_1"
const ANIMATION_LOOK_AROUND_2 = "look_around_2"
@export var idle_state: PlayerState
func enter() -> void:
player.sprite.animation_finished.connect(_on_animation_finished, CONNECT_ONE_SHOT)
player.sprite.play(_get_animation())
func _on_animation_finished() -> void:
switch_state.emit(idle_state)
func _get_animation() -> String:
return ANIMATION_LOOK_AROUND_1 if randi_range(1, 2) == 1 else ANIMATION_LOOK_AROUND_2