Code: Select all
sX = 0
sY = 0
tiles = {}
grass = love.graphics.newImage("grass.png")
forest = love.graphics.newImage("forest.png")
table.insert(tiles,{grass,0,0})
table.insert(tiles,{forest,0,1})
table.insert(tiles,{forest,0,-1})
table.insert(tiles,{forest,1,0})
table.insert(tiles,{forest,-1,0})
function love.draw()
for i,v in pairs(tiles) do
local img = v[1]
local x = v[2]
local y = v[3]
love.graphics.draw(img,
(sX+(x*28)+(y*28))+(400-32),
(sY+(x*14)+(y*-14))+(300-32)
)
end
end
{grass,0,3}
{grass,0,2}
{grass,3,1}
{grass,4,1}
{grass,5,1}
{grass,0,0}
I just can't seem to find the right math to do this, and it'd be cool if someone could help me.