AnimatedSprite2D doesn't run when moving, just shows the first fram

func play_anim(movement):
var dir = current_dir
var anim = $AnimatedSprite2D

if dir == "left":
	anim.flip_h = false
if movement == 1:
	anim.play("animacion_correr")
elif movement == 0:
	anim.play("animacion_quieto")
if dir == "right":
	anim.flip_h = true
if movement == 1:
	anim.play("animacion_correr")
elif movement == 0:
	anim.play("animacion_quieto")
if dir == "down":
	anim.flip_h = true
if movement == 1:
	anim.play("animacion_correr")
elif movement == 0:
	anim.play("animacion_quieto")
if dir == "up":
	anim.flip_h = true
if movement == 1:
	anim.play("animacion_correr")
elif movement == 0:
	anim.play("animacion_quieto")

where do you call this method? If you call it inside “_process” or “_physics_process” this method gets called every frame, which probably overriders the previous animation with a new one and therefore only plays the first frame.

To avoid this you should have a look at “state-machines” on youtube and try to implement one