Godot Version
Godot 4
Question
I have a problem with my AnimatedSprite2D. Currently, I have one AnimatedSprite2D that handles the hands ui for my game. Whenever nothing is happening, they are idle. When the player attacks, they play a hit animation that doesn’t loop. But when the player holds down shift, it plays a looping animation until the player is done holding shift or one of the directional buttons.
But here’s the problem. Whenever the looping animation is playing, it will show ONE frame of the idle animation. How can I fix that? I don’t have the “Running” animation set to loop in the sprite frames.
Here is my code I’m using:
if Input.is_action_pressed("sprint") and Input.get_vector("left", "right", "forward", "backward"):
speed = move_toward(speed, SPRINT_SPEED, accelerationx * delta)
if speed == 20:
Hands.play("Running")
Reaction.play("Full Speed")
elif speed == 0 or speed == WALK_SPEED:
Hands.stop("Running")
else:
speed = WALK_SPEED
Here is what it looks like: