AnimationPlayer with AnimationTree or AnimatedSprite

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nemo

Hi, I’m having a hard time deciding what is the best way to correctly animate my character:
I have the different animations (Idle, Jump, WhileJumping, Hurt, Die) in different files, now I have two ways to do the animation:

  1. Using an AnimatedSprite with all the animations in it and then change them by script
  2. Using the AnimationTree with the AnimationPlayer

My problem is that I want the character to be collidable when the jumping animation is almost ended.

If I use the AnimationPlayer is easy to do this because the editor can edit the single frame at that single time with property keys, but the drawback is that the AnimationPlayer can only have a single Sprite as reference.
So if I want to use it I must create a Sprite for every animation that has to be hidden or not. (Is this right?)

Otherwise if I want to use an AnimatedSprite, I can just load all different animations and then, by code, change the .play() with the animation I want but I will not have the same precision about editing the collision area during the execution of the animation.(Is this right?)

So what is the best to use? Suggestions?

:bust_in_silhouette: Reply From: Clamydeef

I think you should use Animation Player and AnimationTree, because AnimationTree is very flexible when you have a lot of character states and you need to create a whole system. You can, for example, create a sequence of animations, or make a playback condition only when the previous one has ended. Its need to work on this. But if that’s what you need, then the code will be more difficult

Yes that was the best way. I succeded to accomplish what I wanted to do.
The real problem was just to unite the different sprite sheets in one single sprite sheet, then use the AnimationPlayer and AnimationTree to change animation and settings character properties like hitboxes and hurtboxes. Thanks for the reply.

Nemo | 2022-10-29 09:57