Animation does not loop

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Eduardo_Soares

I have an animated sprite with an animation set as a loop, and it doesn’t loop in game. The code is below.

Ps: “$Sprite” is an animated sprite.

func _physics_process(delta):
if Input.is_action_pressed("right"):
	velocity.x = lerp(velocity.x, MAXSPEED, ACCELERATION)
	$Sprite.flip_h = false
	if velocity.x != MAXSPEED:
		$Sprite.play("start_walking")
	else:
		$Sprite.play("walking")
elif Input.is_action_pressed("left"):
	velocity.x = lerp(velocity.x, - MAXSPEED, ACCELERATION)
	$Sprite.flip_h = true
	if velocity.x != MAXSPEED:
		$Sprite.play("start_walking")
	else:
		$Sprite.play("walking")
else:
	velocity.x = lerp(velocity.x, 0, 0.2)
	$Sprite.play("idle")

I forgot to mention, the animation that does not loop is the “walking” animation.

Eduardo_Soares | 2020-10-03 03:10

:bust_in_silhouette: Reply From: Siddharth Pushkar

if you want to loop your animation

first:- If you see where the animation duration is (where the seconds of the animation is) to the right side of the animation UI and there you can see a double arrow loop Symbol just click that you animation will loop

if you want your animation to start as soon as the scene starts then to the right to the animation UI you can see the “edit” text and to the left side of the “edit” text there is an arrow-like symbol which is pointing to the “edit” text click that and when you play the scene the animation will start automatically

I already clicked the loop button, and I want the animation to play after the “start_walking” animation, which is not a loop, but the “walking” one is, and it doesn’t play again.

Eduardo_Soares | 2020-10-03 03:44