I'm developing a platform 2D game and the main caracter, the Princess have multiples animations already working. But some of this animations have sprites with different sizes and because this, the frames don`t stay centralized when the animation play.

  • Have a way to a make a pivot that a I can use as reference for drawing the frames? Or, to define how the frame should expand during the drawing in the canvas?

  • What a I'm trying to do is make all the frames stay centralized in relation with one another for when the animation plays the transition of frames stay looking good. A quick fix that a I have made was to set all the sprites/frames size to the same dimensions. But this is not good, looking I will have a lot of images with small sprites but big dimensions.

Besides that, but relationate with the topic:

When my caracter attack, the sprite size is much more bigger than the collision shape, because the collision shape only cover the body of the caracter, not covering your sword.

  • Have a way that a I can instanciate a new collision shape only when she lands a attack?

This way I will have two collisions in a instant of time, one for the her body and other to the sword attack. (I already looked in other topics (like this) but I not understood right and I don't if the solutions there will fit good in my case).

With the help of the guys o Godot's discord server, I discovered that the same KinematicBody could have more than one collision shape activate at the same time. Soo one of the problems has solved.

But in respect of the image placement, I really need help. I don't get if I must set all frames to have the size dimensions or if have a manner to centralize then in a dynamic way (like make the frame be drawn from bottom to up).

Besides, could an admin change the post as a question type?

Thanks!

@Duds__ said: Besides, could an admin change the post as a question type?

Done :smile:

For the animations, what node are you using? Are you using a Sprite node, an AnimatedSprite node, or something else?

This QA answer mentions that while there is no way to set the pivot per frame in the Godot editor, through GDScript you can define a list of pivot positions and apply them when the animation frame changes using Signals. In the QA answer the user asking for help is using an AnimatedSprite node, but it should work for Sprite nodes with some minor modifications. If you are using an AnimationPlayer node for the animations, you might be able to set the pivot in the Godot editor and keyframe the pivot positions with the frame positions.

I couldn't find anything else from some quick Google searches, but if I find another potential solution I will post it here.

@TwistedTwigleg said: For the animations, what node are you using? Are you using a Sprite node, an AnimatedSprite node, or something else?

Now I'm using the AnimatedSprite, one image per frame.

I have applied the solution proposed on the link: Change the offset image frame by frame. Works.

But I was looking if not have a better solution or a better way to work with sprites of different sizes. I tried to use the auto splice tool and AnimationPlayer but not worked well, in this case, I was using a Sprite sheet with all the character's animation on this. The auto splice tool hadn't was dividing well the frames in some situations, I think that is because of the space between the sprites in the sprite sheet (any tip?) and using the region selector don't work well too.

If I want to make complex interactions with the camera, effects, particles triggering from when a certain animation starts, it's better to try to use AnimationPlayer?

Thanks for the answers!

3 years later