Skip to main content
GameDev.net gamedev.net
🔒 Locked

Standard definition of sprites?

Started by abeylin Nov 16, 2011 at 10:24 PM 3 replies 1.4k views
Original Post
abeylin
abeylin
Hi,

Is there a standard way of describing image positioning in a sprite sheet?

I hope I'm using the proper terminology, so in other words:
A lot of times a single image file will have a lot of tiny images in it. Program would use those individual images for a game/application, but it needs to know the position of those images.
Is there a standard way of describing the positions of those tiny images?
For example maybe a text file:
name:offsetx, offsety, lengthx, lengthy
or in xml:

200100
4025


Is there a standard file format like that?

If not, than is there a recommended way?

And finally, if not even something that's recommended, are there any personal recommendations?
Thank you
Alex
firstelder_d
firstelder_d
I don't know if there is a standard way, but you need 4 things x, y, width, and height. I'm assuming by length x,y you mean width and height. Ideally you would have a tool that makes a binary file, that is then loaded by your game. Any file format you're comfortable with will work though. If using XML this is how I would set it up:

<sprite name="butterfly">
<!--- I wouldn't use offset here, offset suggests the animation frame is offset by an x,y from the actual sprite's x,y --->
<x>200</x>
<y>100</y>
<!--- width and height make a lot more sense than length imho --->
<width>40</width>
<height>25</height>
</sprite>
abeylin
abeylin
agreed, width+height is better, and so is the whole xml you made up.

still kind of disheartening there's no standard for something so commonly used.

Thank you
way2lazy2care
way2lazy2care

agreed, width+height is better, and so is the whole xml you made up.

still kind of disheartening there's no standard for something so commonly used.

Thank you


There are too many variables that are important to program specific optimization for it to be standard imo.
abeylin
abeylin

There are too many variables that are important to program specific optimization for it to be standard imo.


Could you give an example, and are you discussing file-format or data in the file?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.