Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to transform mouse location in isometric tiling map?
    primarykey
    data
    text
    <p>So I've managed myself to write the first part (algorithm) to calculate each tile's position where should it be placed while drawing this map (see bellow). However I need to be able to convert mouse location to the appropriate cell and I've been almost pulling my hair off because I can't figure out a way how to get the cell from mouse location. My concern is that it involves some pretty high math or something i'm just something easy i'm not capable to notice.<br> For example if the mouse position is <strong>112;35</strong> how do i calculate/transform it to to get that the cell is <strong>2;3</strong> at that position? Maybe there is some really good math-thinking programmer here who would help me on this or someone who knows how to do it or can give some information?</p> <p><img src="https://i.stack.imgur.com/noQyV.png" alt="enter image description here"></p> <pre><code>var cord:Point = new Point(); cord.x = (x - 1) * 28 + (y - 1) * 28; cord.y = (y - 1) * 14 + (x - 1) * (- 14); </code></pre> <p>Speaking of the map, each cell (transparent tile <em>56x28</em> pixels) is placed in the center of the previous cell (or at zero position for the cell 1;1), above is the code I use for converting cell-to-position. I tried lot of things and calculations for position-to-cell but each of them failed.</p> <p><strong>Edit:</strong> After reading lot of information <em>it seems</em> that using off screen color map (where colors are mapped to tiles) is the fastest and most efficient solution? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload