# Little help finding closest isometric tile to point

**URL:** <https://forum.kirupa.com/t/little-help-finding-closest-isometric-tile-to-point/329950>\
**Category:** Uncategorized\
**Created:** [November 11, 2012, 9:58am UTC](https://forum.kirupa.com/t/little-help-finding-closest-isometric-tile-to-point/329950 "2012-11-11T09:58:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![reppinfreedom](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@reppinfreedom](https://forum.kirupa.com/u/reppinfreedom)\
**Post date:** [November 11, 2012, 9:58am UTC](https://forum.kirupa.com/t/little-help-finding-closest-isometric-tile-to-point/329950/1 "2012-11-11T09:58:04Z")

</div>

I am using this tutorial right here… And trying to get it to work with my bottom function below. Getting a bit lost… This tutorial has a example FLA but it’s like AS2 or something and confuses the hell out of me. Going to get some sleep and give it another attempt tomorrow.

> **[This is Still Not Better Than Playing Games - To NY pa...](http://tonypa.pri.ee/not-better-playing-games/)**
>
> This page has an interesting story about wondering if playing games back home is more fun and more important than going on family vacations.

//Tile placing code…  
public static function colRowToPoint(Col:int, Row:int, tileSizeX:int, tileSizeY:int):Point {  
var xyPoint = new Point();  
xyPoint.x = (Col - Row) \* ((tileSizeX / 2) + 1);  
xyPoint.y = (Col + Row) \* (tileSizeY / 2);  
return xyPoint;  
}

```
    //This function still needs work, not working yet...
            public static function getClosestCell(Target:Point, tileSizeX:int, tileSizeY:int, mapSize:int):Object {
        var tileDistX = ((tileSizeX / 2) + 1);
        var tileDistY = (tileSizeY / 2);
        var rowCol:Object = new Object();
        rowCol.Row = Math.round((Target.x - Target.y) / tileDistX);
        rowCol.Col = Math.round(((Target.x + Target.y) / 2) / tileDistY);
        return rowCol;
    }

```

Edit: Getting warmer… I think I almost solved it…
