I'm making a tower defence video game and I want to capture the mouse x and mouse y to figure out which tile he is mousing over. My tiles are 48x48, so i used this to get the tile (x=0,y=1 in "tile space" means x=0, y=48 in "normal/mouse space"):
This works excellently for the x but using the same formula for the y results in only the top half of the tile being clickable and the bottom half gets mapped to the tile 1 space lower(
)
My source code is at this address
This works excellently for the x but using the same formula for the y results in only the top half of the tile being clickable and the bottom half gets mapped to the tile 1 space lower(

My source code is at this address