1
\$\begingroup\$

Each animation has its own sprite sheet. First I tried to give each sprite their own rectangle and do some calculations to make sure that the bottom left corner of each sprite would be at the same position as the default sprite's bottom left corner. But I discovered this doesn't work properly for some animations.

So I tried to give all sprites in a sprite sheet the rectangle of the sprite with the biggest dimensions. This works for each individual animation, but when changing from one animation to another the rectangle size changes, so it gives the same problem as the first method. Additionally, when flipping the character it's flipped around the center of the rectangle, not necessarily the character.

Now I'm thinking of using the second method, but for each animation defining a pivot point that the character will be flipped around and a sprite offset will be calculated in relation to the x and y distance between the pivot point of the default animation and the current one, so that the character center will always be at the same position. This is manual and thusly means more work and is prone to human error. Is this really the best method? It's certainly better than defining this offset manually for each sprite.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.