Isometrics
for the life of me, I cannot figure out how to translate the mouse to my isometric map. this is my code for how i'm trying to do it and the way it is used in the draw function
updateMap = function()
tMouseX = ((mouse.x/2-mouse.y/4)/2)
tMouseY = ((mouse.y/2-mouse.x/4)/2)
for t in tiles
local x = (t.x/4-t.y/2)*tWidth
local y = (t.x/4+t.y/2)*tHeight
if collision(t.x,t.y,1*camera.scale,1*camera.scale,tMouseX-camera.x,tMouseY-camera.y,0.1,0.1) then
t.sprite = "port"
else t.sprite = "tile" end
end
end
drawMap = function()
for t in tiles
local x = floor((t.x/2-t.y/2)*tWidth)
local y = floor((t.x/4+t.y/4)*tHeight)
screen.drawSprite(t.sprite,x,y,tWidth,tHeight)
screen.drawSprite("icon",t.x,t.y,1)
end
screen.drawSprite("icon",tMouseX-camera.x,tMouseY-camera.y,12,12)
end
if you know anything about isometrics, please help