Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sprite sheet data  (Read 2468 times)

0 Members and 1 Guest are viewing this topic.

Vitis

  • Newbie
  • *
  • Posts: 10
    • View Profile
sprite sheet data
« 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/

(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     

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: sprite sheet data
« Reply #1 on: July 03, 2014, 07:27:54 pm »
Check out TexturePacker : http://www.codeandweb.com/texturepacker

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: sprite sheet data
« Reply #2 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: sprite sheet data
« Reply #3 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 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Vitis

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: sprite sheet data
« Reply #4 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.   

 

anything