I'm trying to run animation of walking on my player, if i press right arrow the animations plays but i want it to loop as long as i hold the key.
Does anyone know how to do this?
This is some of the code:
...
func _process(delta):
velocity.y += delta * GRAVITY
if (Input.is_action_pressed("ui_left")):
velocity.x = - WALK_SPEED
anim.play("walk")
elif (Input.is_action_pressed("ui_right")):
velocity.x = WALK_SPEED
anim.play("walk")
else:
velocity.x = 0
....
func _ready():
anim = get_node("AnimationPlayer")
set_process(true)