Hi, i'm doing a 8 directional movement using animation player, but everytime I change directions it begins at frame 0, so it seems like the character is sliding with one leg. I would like to know how could I pass the currently frame to the next animation when changing directions. You can find the code here: https://kidscancode.org/godot_recipes/2d/8_direction/

AnimatedSprite has a frame property: https://docs.godotengine.org/en/stable/classes/class_animatedsprite.html

So right before you change animations, save the frame, and then restore it after changing.

var current_frame = $AnimatedSprite.frame
$AnimatedSprite.animation = current_animation + str(a)
$AnimatedSprite.frame = current_frame

@cybereality said: AnimatedSprite has a frame property: https://docs.godotengine.org/en/stable/classes/class_animatedsprite.html

So right before you change animations, save the frame, and then restore it after changing.

var current_frame = $AnimatedSprite.frame
$AnimatedSprite.animation = current_animation + str(a)
$AnimatedSprite.frame = current_frame

I see, I'll try it using Animated Sprite then. Also how would it work without Animated Sprite? Was trying a few different approaches with advance and seek but didn't found a way yet.

Oh sorry, I was just using the code from the tutorial. With AnimationPlayer you would use seek. However seek takes a value in seconds, not frames. So you will have to calculate where exactly that frame is in the animation is seconds. Assuming all the animations have the same length, you can do this:

var current_position = $AnimationPlayer.current_animation_position
$AnimationPlayer.play("run")
$AnimationPlayer.seek(current_position)
9 months later