Cant beat this isometry
Posted: Fri Oct 09, 2015 10:33 pm
So, i have a map made of isometric tiles. I did it just easy and naive like
but i cant get the exact tile coordinate at any cost. I'm using Vrid's Camera from HUMP, and i'm trying to do this like:
Can someone explain how to do it properly? I'm thowing 100ish paper sheet with plots and maths right now and im totally frustrated.
Code: Select all
for i = 1,#world do
for j = 1,#world do
tile = world[i][j]
if tile == '0' then
love.graphics.draw(grass,(i-1)*32-((j-1))*32,((j-1)*32+(i-1)*32)/2)
elseif tile == '1' then
love.graphics.draw(rocks,(i-1)*32-(j-1)*32,((j-1)*32+(i-1)*32)/2)
end
end
end
Code: Select all
x, y = cam:mousepos()
coordX = math.floor((x-y)/32)
coordY = math.floor((x+y)/64)