Mouse location on isometric maps
Posted: Fri Jul 16, 2010 6:15 pm
Wow, this is a tough one. I usually have an easy time figuring out how to solve small problems like this, but I'm stuck.
I'm trying to write a function that return which tile the mouse is currently hovering over on an isometric map. The code I sue to draw the tiles is the same as in the tutorial:
Given that, how do I write a function that returns the X and Y values for which tile the mouse is over?
I'm trying to write a function that return which tile the mouse is currently hovering over on an isometric map. The code I sue to draw the tiles is the same as in the tutorial:
Code: Select all
-- earth
love.graphics.drawq( images.world.tiles.earth[5],
quads.tiles.earth.default[1][map.tile_map[y+map_y][x+map_x].earth.image],
( x - y ) * ( map.tile_w / 2 ) + map.offset_x + scroll_x,
( x + y ) / 2 * map.tile_h + map.offset_y + scroll_y,
0,
map.scale_x,
map.scale_y,
1,
1
)