Page 1 of 1

How to get x,y,z position from .map ix?

Posted: 27 Nov 2014, 13:39
by frcol
Hi bax and Paolo,
I´m creating a GPS inside my application and to show where things are we´ve decided to get the .map to get the x,y position of the tiles that we need.

What´s exactly the logic used to tranform ix in coordinates (ex: 21486 in a 100x80 map)? It´s coordinate is 86,54,2.

We need the 86,54,0 tile, but we don´t know it, we just have the 21486.

we are subtracting 8000 (each layer Z), so this tile is in z = 2.
then we divide the result (5486) by 100 (the width), result = 54,86 (the y position = 54)
Then we get the 0,86 and multiply by 100 (width), and get the x = 86

Is that correct? It will work for all tiles?

thanks

Re: How to get x,y,z position from .map ix?

Posted: 02 Dec 2014, 07:57
by Bax
ix counter starts from the lower level (z=0) and from the tile in the upper, left corner (x=0, y=0), moving right and down.
So your math is right.