Screen-space mouse coordinates to tile coordinates -------------------------------------------------- The general dimetric projection matrices in [my answer to the question linked above](http://gamedev.stackexchange.com/a/34791/1141) will get you the transformation from screen coordinates to tile coordinates. In particular, this matrix can be used for transformation of the screen coordinates to tile coordinates: ![](https://i.sstatic.net/YwQdO.gif) The values to input are: * *w*: **half** of the width of a single tile on screen * *h*: **half** of the height of a single tile on screen * *f*<sub>x</sub>: X-Position of the upper corner of the (0,0) tile in screen coordinates * *f*<sub>y</sub>: Y-Position of the upper corner of the (0,0) tile in screen coordinates The mouse coordinates have to be extended by a constant value of 1 to be a 3-dimensional vector (*x*<sub>mouse</sub>, *y*<sub>mouse</sub>, 1) and multiplied by this matrix to arrive at the tile coordinates. Tile coordinates to tile indices -------------------------------- Unfortunately if you apply them straight away to your image, you'll find that the actual tile indices aren't quite in line with their coordinates. ![enter image description here][1] The somewhat thicker green lines in the picture are at coordinates *x*=0 and *y*=0; the others are spaced one unit of length apart. Remember that the *y* coordinate goes *down* as usual with computer graphics, so the tile indexed by (1,0) is in the tile with coordinates *x*=[1, 2) and *y*=[-1, 0). Given the "normal" integer tile coordinates *x* and *y* (in blue on the picture above), you can calculate your tile indices *x*<sub>ind</sub> and *y*<sub>ind</sub> with the following formulas<sup>(1)</sup>: *x*<sub>ind</sub> = floor(*x* - *y* + 1)/2) *y*<sub>ind</sub> = *x* + *y* ------------------ (1) In this context, the floor() function rounds *down* towards -∞. [1]: https://i.sstatic.net/1JHgT.png