I just started the language LUA / Love2d and I test myself on an ISO map, so I managed to make a base but I would add entities over (walls, trees, rocks, ect ...) someone has a trick to give me to superpose layers ?
best regards

Code: Select all
local BRIQUE_LARGEUR = 64
local BRIQUE_HAUTEUR = 64
local camera = {}
camera.x = (love.graphics.getWidth() / 2) - BRIQUE_LARGEUR/2
camera.y = 0
local _MapSol = {}
local _ImgTiles = {}
_ImgTiles["1"] = love.graphics.newImage("img/tile_Grass1.png")
_ImgTiles["2"] = love.graphics.newImage("img/tile_Stone1.png")
_ImgTiles["3"] = love.graphics.newImage("img/tile_Road1.png")
function LoadMap( )
_MapSol[1] = "2222332222"
_MapSol[2] = "2111331112"
_MapSol[3] = "2111331112"
_MapSol[4] = "2111331112"
_MapSol[5] = "3333333333"
_MapSol[6] = "3333333333"
_MapSol[7] = "2111331112"
_MapSol[8] = "2111331112"
_MapSol[9] = "2111331112"
_MapSol[10] = "2222332222"
end
function love.load()
love.window.setTitle( "ISOMETRIQUE TEST" )
love.window.setMode(800, 600, {fullscreen=false, vsync=true, minwidth=800, minheight=600})
LoadMap()
end
function love.update(dt)
end
function love.draw()
local ligne,colonne,char
for ligne=1,10 do
for colonne=1,10 do
char = string.sub(_MapSol[ligne],colonne,colonne)
if _ImgTiles[char] ~= nil then
local x = (colonne - ligne) * BRIQUE_LARGEUR/2;
local y = (colonne + ligne) * BRIQUE_HAUTEUR/4;
love.graphics.draw(_ImgTiles[char], x + camera.x, y + camera.y)
end
end
end
end
function love.keypressed(key)
if key == "escape" then
love.event.quit()
return
end
end