I have a position on the screen, how do I calculate which grid tile that position is inside?
I know the number of tiles in the grid, and the size of the screen (including how many tiles fit on it horizontally and vertically).
|
|
Ok this code is based on all tiles being shown on the screen.
If you don't have all tiles on screen then you would offset the x,y from above by the lowest x,y cell you are displaying. |
|||
|
|