init
This commit is contained in:
26
player/scripts/state_idle.gd
Normal file
26
player/scripts/state_idle.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
class_name State_Idle extends State
|
||||
|
||||
@onready var walk: State = $"../walk"
|
||||
@onready var attack: State = $"../attack"
|
||||
|
||||
func enter() -> void:
|
||||
player.update_animation("idle")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func process(_delta : float) -> State:
|
||||
if player.direction != Vector2.ZERO:
|
||||
return walk
|
||||
player.velocity = Vector2.ZERO
|
||||
return null
|
||||
|
||||
func physics(_delta : float) -> State:
|
||||
return null
|
||||
|
||||
func handle_input(event : InputEvent) -> State:
|
||||
if event.is_action_pressed("attack"):
|
||||
return attack
|
||||
if event.is_action_pressed("interact"):
|
||||
PlayerManager.interact_pressed.emit()
|
||||
return null
|
||||
Reference in New Issue
Block a user