Animation defenition moved to player_sprite.gd

This commit is contained in:
2026-02-03 00:00:51 +03:00
parent 63710b691b
commit 67c5f8e4d5
16 changed files with 116 additions and 53 deletions
@@ -1,10 +1,6 @@
extends PlayerState
const ANIMATION_LOOK_AROUND_1 = "look_around_1"
const ANIMATION_LOOK_AROUND_2 = "look_around_2"
func enter() -> void:
player.sprite.animation_finished.connect(_on_animation_finished, CONNECT_ONE_SHOT)
player.sprite.play(_get_animation())
@@ -15,4 +11,7 @@ func _on_animation_finished() -> void:
func _get_animation() -> String:
return ANIMATION_LOOK_AROUND_1 if randi_range(1, 2) == 1 else ANIMATION_LOOK_AROUND_2
if randi_range(1, 2) == 1:
return PlayerSprite.ANIMATION_LOOK_AROUND_1
else:
return PlayerSprite.ANIMATION_LOOK_AROUND_2