1
\$\begingroup\$

This question already has an answer here:

I recently converted the display style of a isometric map from staggered to diamond and I can't figure out the tile picking process.
I'm well aware of the other existing threads regarding this subject and I read all of them but I haven't figured out a solution (my concentration these days is a mess)
I'm using a very basic system which consists of passing through all tiles and pick the one where the mouse points at (something like this Map.Tile.Intersects(mouse.Rect) ) and then with the help of a color map I pick the correct tile.
But I don't like this system because is pretty inefficient compared to some mathematic solutions I saw and didn't understand.
So here is the code I use to create the map :

                int x = 128 * j;
                int y = 64 * i;
                int isoX = (6 * 64) + (x - y);
                int isoY = (x + y) / 2;

128 is the tileWidth , 64 tileHeight and 6 * 64 is the xOffset

And the coordinates are like this : enter image description here

Can somebody give me some hints or explain what I should do ?
Thank you.

\$\endgroup\$

marked as duplicate by Anko, MichaelHouse Dec 21 '13 at 5:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.