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.
public function getTilePosFromXY(x:int, y:int):Array
{
return [x * _tileSize - y * _tileSize, (y * _tileSize * _ratio) + (x * _tileSize * _ratio)]
}
Any ideas?