 # Image objects in Isometric map are placed at the wrong location when loading map

We’re trying to use MTE to display an isometric tile map in our game and noticed that objects are drawn in the wrong location when loading the map.

The drawObject function is using the following level positions when adding the sprite of the object:

``````levelPosX = object.x - (worldScaleX \* 0.5) levelPosY = object.y - (worldScaleX \* 0.5)
``````

However, the object.x and object.y parameters are in pixel coordinates from the tmx file, which do not align with either the screen position or the level position.

So we need to perform some calculations to get the level position from the x and y values.

Any idea what these calculations need to be?

Any help would be greatly appreciated.

Eventually we were able to calculate the location from the x and y position:

``````local locX = ((object.x/2 - levelHeight \* M.isoScaleMod \* 0.5) / map.actualTileheight) + 1 local locY = ((object.y/2 - levelHeight \* M.isoScaleMod \* 0.5) / map.actualTileheight) + 1
``````

and just gave locX and locY to the addSprite function instead of the levelPosX and levelPosY.

Just a nod of thanks for posting the solution. Many folks make a post, and I come across it in a forum search, but never find the answer either.

So, thank you.

Eventually we were able to calculate the location from the x and y position:

``````local locX = ((object.x/2 - levelHeight \* M.isoScaleMod \* 0.5) / map.actualTileheight) + 1 local locY = ((object.y/2 - levelHeight \* M.isoScaleMod \* 0.5) / map.actualTileheight) + 1
``````

and just gave locX and locY to the addSprite function instead of the levelPosX and levelPosY.

Just a nod of thanks for posting the solution. Many folks make a post, and I come across it in a forum search, but never find the answer either.

So, thank you.