# Isometric engine -- screen pixel coord to isometric tile (X,Y)

**URL:** <https://forum.kirupa.com/t/isometric-engine-screen-pixel-coord-to-isometric-tile-x-y/304296>\
**Category:** flash\
**Created:** [February 5, 2010, 12:44am UTC](https://forum.kirupa.com/t/isometric-engine-screen-pixel-coord-to-isometric-tile-x-y/304296 "2010-02-05T00:44:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [February 5, 2010, 12:44am UTC](https://forum.kirupa.com/t/isometric-engine-screen-pixel-coord-to-isometric-tile-x-y/304296/1 "2010-02-05T00:44:12Z")

</div>

What I’m trying to do is convert a mouse location (something like x : -400 y: 1200) to a particular tile… something like (10, 13). It’s easy to go the other direction and get the origin of the tile, but I’m not having a ton of luck on the opposite direction.

So, in this example you see all the little squares – they’re mostly contained in the 10,13 tile – and I want to get that conversion from there. What in the hell would that formula look like? This is how I’m doing it the other direction, but I need to coerce the numbers back to this form before I can get an absolute X/Y.

```auto

public function getTilePosFromXY(x:int, y:int):Array
{
	return [x * _tileSize - y * _tileSize, (y * _tileSize * _ratio) + (x * _tileSize * _ratio)]
}

```

![](http://forum.kirupa.com/uploads/kirupa/6121/2035050ab63e895a.jpg)

Any ideas?
