Slicing up sprite sheets for complex characters.

If not best practices, could someone provide an example?

The issues that I’m facing are that the artist I’m working with and I have a player character that we want to animate that will be around 32 wide by 64 high.

He may have a spear, which may be 128 long.

Should we create one sprite sheet for that character with all of the animation stuff manually specified with xml or should we create three sheets, 64x64, 128x128, 256,256, etc?

EDIT: Think like secret of mana, evermore, beyond oasis.

The issue is since java draws from top left coordinates then we’ll have to be constantly concerned about the offset of the sprite since his location will be in reality x and y away from the location that the top left of his sprite needs to be drawn at.

I’m not quite sure I understand what your problem is?

If your character is 32x64, then have all the frames of his animation in 1 image that is (n*32)x64 (n being the number of frames).

And the only thing you should be worrying about is the X and Y position of your character in world coordinates. You should only be converting to screen coordinates when drawing.

I think I understand what you are saying. Although I I may not be the best person to answer this.

Basically the drawing will be all screwy because the top left corner you are drawing from is changing do to different sized sprites.

One idea is to have a default size for all sprites for a character, say 6464, even though the walk animation may only be 3264.

The other is to have any spears/weapons/magic have their own sprite and be drawn on top of the character. This may make collisions for attacking easier.

The last idea would be to calculate the offset for the different sized sprites and add/subtract them from your drawing coordinates.
This I think is the best.

Here is a video to show what I think is going on for those with more expertise.

Oh! I see what the OP means now. The easiest way is to make the spritesheet as tall as the tallest frame then just add alpha above the smaller ones. In a separate file (like the XML file you mentioned) you would set the offset for bounds checking against certain frames.

Just like in StumpyStrust’s video, but all in 1 spritesheet:

http://ra4king.is-a-geek.net/public/test.png

Wow, there are so many ingenious tricks involving images. I’ll have to check out this video, hopefully I can find some code samples?