- Edited
i made a part of a script that's meant to make a running animation play when holding the "run" key down while pressing the basic movement keys, "left" and "right", but only ends up having the running animation play the first frame (out of six, in case it might matter).
EDIT: the full running animation only plays when falling
this is the code used to make the animations play (uses AnimatedSprite2D for animations):
func update_animations(input_axis):
if is_on_floor():
if Input.is_action_pressed("right") or Input.is_action_pressed("left"):
$AnimatedSprite2D.play("walk")
else:
$AnimatedSprite2D.play("idle")
if Input.is_action_pressed("run") && input_axis != 0:
$AnimatedSprite2D.play("run")