You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
591 B
25 lines
591 B
4 months ago
|
function LoadMap(lvlnum)
|
||
|
--TODO: FINISH THIS
|
||
|
local mapfilelocation = "maps/"
|
||
|
local extention = ".lua"
|
||
|
|
||
|
--unload the current map
|
||
|
if GameMap then
|
||
|
GameMap:removeLayer("Walls")
|
||
|
end
|
||
|
|
||
|
--load the new map
|
||
|
GameMap = mapfilelocation .. "map" .. lvlnum .. extention
|
||
|
|
||
|
--load the new map's walls
|
||
|
Walls = {}
|
||
|
if GameMap.layers["Walls"] then
|
||
|
for _, obj in ipairs(GameMap.layers["Walls"].objects) do
|
||
|
local wall = World:newRectangleCollider(obj.x, obj.y, obj.width, obj.height)
|
||
|
wall:setType("static")
|
||
|
table.insert(Walls, wall)
|
||
|
Walls[#Walls]:setCollisionClass("Wall")
|
||
|
end
|
||
|
end
|
||
|
end
|