# Staggered Isometric - Screen To Tile

This topic is 4012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi! Everyone, I'm working on a staggered isometric engine. Where tiles are like this... [0,0][0,1][0,2][0,3] [1,0][1,1][1,2][1,3] [2,0][2,1][2,2][2,3] [3,0][3,1][3,2][3,3] and of course tiles are diamond shaped. But I'm having problem converting screen coordinates to tile row and column mathemetically. My solution has to be mathemetically... does anyone know the solution? Please help. Thanks in advance.

##### Share on other sites
I'm assuming you mean that the rectangle you showed in your post would be rotated 45 degrees clockwise (ie. with [0,0] at the top and [0,1] beneath and to the right of it, etc. - which is reverse of how I have mine).

In which case:

tileX = (screenY / tileHeight) - (screenX / tileWidth);
tileY = (screenY / tileHeight) + (screenX / tileWidth);

Assuming that screen (0,0) corresponds to tile(0,0).

Tilewidth and tileheight are the dimensions of the tile bitmap, if you like.

##### Share on other sites
Hi! No, diamond isometric :). I need staggered isometric equations. Thanks.

##### Share on other sites
Oh I see. Sorry, I misunderstood - in that case I don't know the answer. I find it easier to use an abstract rectangular tilemap (like a grid of paper, say), and have it staggered only at the rendering stage (like Diablo etc.). If your tilespace is such that 0,0 is in the upper left of the screen and n,n is in the lower right, then I'm not sure how you'd go about converting screen to tile coordinates I'm afraid (although I'm sure it is possible I'm sure).

Maybe someone else has done this?

##### Share on other sites
I think here is the answer .... in javascript.

http://opencjk.org/~yumj/isometric_mouse2tile.html

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 70
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632967
• Total Posts
3009571
• ### Who's Online (See full list)

There are no registered users currently online

×