Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/161183384708710400
added 302 characters in body
Source Link
Ben
  • 517
  • 2
  • 4
  • 15

WithFor a spritesheet like the following onewith non-uniform sprite dimensions, how can oneI get the coordinates ofbounding-rectangles for each individual spritessprite (i.e. the blue boxes in the following image / I only drew a few examples)?

enter image description here What I would like to determine are: offset_x, offset_y, width, height

enter image description here

So far, I have only used spritesheets on which all sprites have identical dimensions. In that case, one simply needs to specify the x- and y-offset to get a particular sprite.

  However, most of thefor spritesheets I find online contain sprites of varyingnon-uniform dimensions, this doesn't work.

EDIT: Having read through the comments and answers, I would likerephrased my question to know why people do that and how I can deal with it (specifying the coordinates manually for each sprite onmake it more inclusive wrt. the sheet isactual process of using a huge pain..spritesheet in a game.) Previously, the question contained the points why people produce spritesheets of non-uniform dimensions and how I can deal with that.

With a spritesheet like the following one, how can one get the coordinates of individual sprites?

enter image description here

So far, I have only used spritesheets on which all sprites have identical dimensions. In that case, one simply needs to specify the x- and y-offset to get a particular sprite.

  However, most of the spritesheets I find online contain sprites of varying dimensions, and I would like to know why people do that and how I can deal with it (specifying the coordinates manually for each sprite on the sheet is a huge pain...).

For a spritesheet with non-uniform sprite dimensions, how can I get the bounding-rectangles for each individual sprite (i.e. the blue boxes in the following image / I only drew a few examples)?

What I would like to determine are: offset_x, offset_y, width, height

enter image description here

So far, I have only used spritesheets on which all sprites have identical dimensions. In that case, one simply needs to specify the x- and y-offset to get a particular sprite. However, for spritesheets of non-uniform dimensions this doesn't work.

EDIT: Having read through the comments and answers, I rephrased my question to make it more inclusive wrt. the actual process of using a spritesheet in a game. Previously, the question contained the points why people produce spritesheets of non-uniform dimensions and how I can deal with that.

edited title
Link
user1430
user1430

Spritesheets and Coordinates How can I handle sprite sheets with nonuniform sprite dimensions?

edited tags
Link
Ben
  • 517
  • 2
  • 4
  • 15
Source Link
Ben
  • 517
  • 2
  • 4
  • 15
Loading