Confused about 2D animation

Godot Version

4.6.2 stable

Question

Hi there,

I am reading the documentation/tutorial about 2D sprite animation, for retro-pixel art games.

If I understand correctly, there are several possibilities, and I’m a bit confused and lost:

  • Sprite2D
  • AnimatedSprite2D
  • AnimationPlayer
  • And apparently also AnimationTree which is a kind of state machine

… but there are also 3rd party assets for state machines.

My problem: I just don’t know which one is the best for my use case!

I prepare my spritesheet based on sprite resources, for instance megaman

Just imagine it’s cleaned up, packed, and in a regular grid, each frame is 32x32. But I can totally have 2 different animations per rows, or one single sprite alone for the jump. But for sure they are in a grid.

Then obviously, I will need a way to handle the states in my character controller. I have basic transitions and states (idle, jump, run, fire, run_fire…) .

Anyway, which method do you use for basic 2D sprite animation, and why? I am leaning towards AnimatedSprite2D and doing the rest myself with code/data. Instead of clicking many times in the editor tools, I would rather use config/data files, or resources, to create all the animation automatically. Is that possible?

Any good tutorial/video will be appreciated, thanks.

Use an AnimatedSprite2D. Go find some tutorials on it.

AnimationPlayer is useful in many situations, but is typically overkill for 2D unless you are using a Skeleton2D and InverseKinematics (since you are using a spritesheet, you are not doing that).

AnimationTree is only usable if you are using an AnimationPlayer, so forget about it. For the record, AnimationTree can use an AnimationStateMachine, it is not one.

Sprite2D has functionality for animating it, but honestly, I’m not sure why. It’s much less intuitive than AnimatedSprite2D. I suspect Sprite2D just had the functionality, and it was not removed when AnimatedSprite2D was introduced to prevent a breaking change in people’s games.

If you want to create the animations automatically, you can look at my ChibiAnimatedSprite2D Plugin. You would have to adapt the code.

Replying a bit late, but thanks for your insights, very useful feedback. Will stick to AnimatedSprite2D, will see how I can use it with a data driver approach.

1 Like