Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a isometric grid with sprites that are placed in this sort of manner:

x: 5
y: 7
OffsetX: 5px
OffsetY: 10px

This is - what i want to do is when placing a new sprite, check to see if they collide, i can do it quite easily by just checking the x and y but the offset confuses me on how i can efficiently check for a collision.

Dose any one have any suggestions on neat ways to efficiently check collisions with offsets?

share|improve this question
I assume x and y are the location of the sprite's tile on the isometric grid, and that OffsetX and OffsetY are regular rectangular pixel offsets? You're going to need to define a size for these sprites... once you go beyond "two sprites can't share a tile," you can't get any further without saying "this sprite is a 20x20 pixel box" or "this sprite is a circle with radius 30px." – John Calsbeek Feb 18 '13 at 3:53
I have the image dimensions which i from the image properties like: image.width will equal the image in pixels wide. Although its more complex due to alot of sprite images contain alpha areas. Which is why its hard. – Dave Feb 18 '13 at 4:08
up vote 2 down vote accepted

using the dimensions of your 2D sprite representing your isometric object doesn't sound like a solid idea to me. a long object along the x axis might has the same sprite width as an object which is wide along the y axis, but both might have different collision boxes.

I would treat those 2 values seperate and calculate collision using bounding boxes that approximate the dimension in isometric space. the offset makes sense because sometimes its not easy to approximate a box for your object. if you have a tree for example, the crown is going to be much bigger than the actual collisionbox which only includes the trunk, but you also want to have the sprite centered within the box and therefor you move the 2D sprite using your offset values.

enter image description here

The image above shows a large sprite (white), with a small collision box (blue) and some offset is used to center the sprite correctly.

Seperating your visual representation from the collision is the way to go in my opinion, even if objects can't be larger then 1 tile of your grid.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.