I have a function isoToScreen(x, y)
that converts Isometric coordinates to Screen coordinates.
var tileW = 16;
var tileH = 16;
var isoToScreen = function(x, y) {
var posX = (x - y) * tileW;
var posY = (x + y) * tileH / 2;
return [posX, posY];
};
But how would I make a function that converts screen coordinates back to Isometric coordinates?
var pos = screenToIso(16, 8);
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y
Thanks in advance.