I have 2 coordinates (X,Y). I have also a 10x10 array. By these coordinates I have to find the rectangle in which is my pointer at the moment. How could I handle it?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
If your grid array is displayed as a Rectangle(ox,oy, 10*CELL_SIZE, 10*CELL_SIZE), where (ox,oy) is an offset... then the cell coords are
of course you should check the coords are in right range (0..9,0..9) |
|||
|
|
10x10 arrayand the rectanglein which the pointer is inI guess he might be talking about having a tile grid on screen and figuring out which tile is under the mouse pointer. But yeah the question is very unclear, and we could use more information such as, where does the grid start. – David Gouveia May 19 '12 at 8:52