I draw isometric map with tile 64×32:
const Offset = 160;
int X, Y;
for (int a=0; a < 6; a++)
for (int b=0; b < 6; b++) {
X = a * 32 - b * 32 + Offset;
Y = a * 16 + b * 16;
DrawTile(X, Y, tile);
}
Image, illustrating this code: https://i.stack.imgur.com/Rc4kD.png
Dear professionals, please, help with a formula of transformation of mouse coordinates in isometric indexes of a cell. Example: (105; 100) -> [1; 4].
Thanks.
P.S. Please excuse my bad English. I’m just learning…
You have two basis vectors p=(32,16) and q=(-32,16). Any vector r is linear combination of p and q:
Added:
Note that I’ve used middle top point as coordinate zero and take into account your offset