2025-08-30 02:13:19 +03:00

31 lines
684 B
Lua

--- @class Map
--- @field atlas love.Image
--- @field size Vec3|nil
local map = {}
map.__index = map
--- create new map
--- @param type "procedural"|"handmaded"
--- @param template Procedural|Handmaded
--- @param size? Vec3
local function new(type, template, size)
map.size = size
local tMap = require('lib.level.' .. type).new(template, size)
return setmetatable(tMap, map)
end
function map:draw()
for y = 0, self.size.y - 1 do
for x = 0, self.size.x - 1 do
love.graphics.draw(self.atlas, self[x][y].quad, x, y,
nil, 1 / 32, 1 / 32)
end
end
end
function map:get(x, y)
return self[x][y]
end
return { new = new }