The book Social isometric games , on page 53, describes a method for determining a tile by mouse cardinates. Everything works, but it is not clear by what principle it is calculated. Can someone explain this algorithm in detail? Can references to the formula are available. Or at least in what field of science to look for it.

An example of a piece of code that interests you:

var col = (e.clientY - gridOffsetY) * 2; //??? col = ((gridOffsetX + col) - e.clientX) / 2; //??? var row = ((e.clientX + col) - tile.height) - gridOffsetX; //??? 
  • "Or at least in what field of science to look for it." - the captain suggests that in geometry. - Xander
  • Nothing complicated really. Try to figure out for yourself how to convert screen coordinates to tile coordinates, you get about the same functions. - Vladimir Gamalyan
  • No, I can not catch up. Why do we multiply the Y point by 2? why on 2 !? and how is it possible to subtract X from Y ... these are different axes. - Dmitry Zaharov

0