14 lines
350 B
GDScript
14 lines
350 B
GDScript
class_name PlayerIdleState
|
|
extends PlayerState
|
|
|
|
func enter(_msg := {}):
|
|
player.velocity = Vector2.ZERO
|
|
player.animation_player.play("idle")
|
|
|
|
func update(_delta):
|
|
if get_input_direction() != Vector2.ZERO:
|
|
state_machine.transition_to("Walk")
|
|
|
|
func get_input_direction():
|
|
return Input.get_vector("move_left", "move_right", "move_up", "move_down")
|