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")