How do i use the animation player

Godot Version

Version 4

Question

How can i use animation player to play an animation from animatedsprite2d

Have you followed the 2D Sprite Animation Tutorial yet?

I have indeed, but i dont want to add individual frames to the animation player, instead i just want to keyframe in the animation player to play the animation from the animationsprite

image

I think im doing the same thing but nothing seems to be happening

Now you can key your sprite frames, notice the keys in the rightside of the Inspector?

I should be using the key next to current animation right

If you selected the AnimatedSprite2D you can key the Animation property or you can key the frames individually.


problem is that i get this error

AnimatedSprite2D can’t be animated, Sprite2D is ok

That’s because you didn’t select the AnimatedSprite2D, the AnimationPlayer is still selected.

This is incorrect, both are animatable. Even an AnimationPlayer can animate other AnimationPlayers

Ah I think I got it, but I will still need to key to every frame of the animatedsprite, is there a way to just playback an animation I have setup in animationsprite?

If I understand correctly what you want: you can use the AnimationPlayer to toggle the AnimatedSprite’s “playing” property between true and false. That would turn on/off the animation.

yes thats what i want

Just set your animation to the reset track or a idle animation when not doing anything.
Look into state machines.
You can also make one using enums and the match keyword instead of the node route.