This question already has an answer here:
- 2D isometric: screen to tile coordinates 3 answers
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 :
Can somebody give me some hints or explain what I should do ?