Skip to main content
4 of 4
added 302 characters in body
Ben
  • 517
  • 2
  • 4
  • 15

How can I handle sprite sheets with nonuniform sprite dimensions?

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.

Ben
  • 517
  • 2
  • 4
  • 15