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
@@ -1 +1,23 @@
extends PlayerState
const ANIMATION_IDLE = "idle"
const LOOK_AROUND_CHANCE = 25
@export var look_around_state: PlayerState
func enter() -> void:
player.sprite.animation_looped.connect(_on_animation_looped)
player.sprite.play(ANIMATION_IDLE)
func exit() -> void:
player.sprite.animation_looped.disconnect(_on_animation_looped)
func _on_animation_looped() -> void:
if randi_range(1, 100) <= LOOK_AROUND_CHANCE:
switch_state.emit(look_around_state)