2
\$\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\$
1
  • \$\begingroup\$ What game engine are you using? We can’t help until you tell us. \$\endgroup\$ Commented Feb 11, 2021 at 23:34

0

You must log in to answer this question.

Browse other questions tagged .