SFML community forums

Help => Graphics => Topic started by: Vitis on July 03, 2014, 06:27:05 pm

Title: sprite sheet data
Post by: Vitis on July 03, 2014, 06:27:05 pm
Greetings SFMLers!

I am currently working on a game that features an animated character sprite.  I am using this sprite sheet as a placeholder while I develop the game: http://www.spriters-resource.com/fullview/41519/
 (http://www.spriters-resource.com/fullview/41519/)
(I eventually plan on making my own pixel art for the character.)

My problem relates to obtaining the rectangle data for each individual character image in the sprite sheet.  It took me many hours to manually obtain and enter all the x/y pixel coordinates and height/width values in order to create tightly bound rectangles to properly display each frame of the animated character. (This particular sprite sheet is comprised of well over 300 individual character frames/images.)  I was wondering if anyone knows of a better, more efficient way to get all this data instead of having to obtain it one frame at a time from a sprite sheet like I did.

Regards,
-Vitis     
Title: Re: sprite sheet data
Post by: Jesper Juhl on July 03, 2014, 07:27:54 pm
Check out TexturePacker : http://www.codeandweb.com/texturepacker
Title: Re: sprite sheet data
Post by: eXpl0it3r on July 03, 2014, 07:28:08 pm
There are many sprite sheets where the bounding box of each frame is essentially always the same size (e.g. tileset), with such an image you just have to figure out the size once and then multiply it accordingly. With more complex sheets as you've shown above one would at the point of packing all the standalone images into one sheet, let the packer (see an example above) generate a accompanying file that would tell where which sprite can be loaded from etc.
Of course if you just end up with the sprite sheet and the bounding boxes are irregular in size, then there's not much you can do other than map it manually. Maybe, just maybe there is some application that would be able to find out the borders of a character and thus making things a bit easier, I don't know such an application though.
Title: Re: sprite sheet data
Post by: Hapax on July 04, 2014, 01:10:02 am
If you are going to manually extract the images from the sheet, you could use the slice feature in Photoshop to help. Pretty sure GIMP (http://www.gimp.org/) has the feature too. The grid, guides, and snap functions available can also be useful if you want to extract images with re-occurring sizes.

Check out TexturePacker : http://www.codeandweb.com/texturepacker
It looks like this only creates sprite sheets.
Title: Re: sprite sheet data
Post by: Vitis on July 04, 2014, 11:34:27 am
Thank you all for your help.  I always seem to get a variety of good suggestions and opinions from the SFML community whenever I post something.