maps now clear their Wall tables before making new ones
This commit is contained in:
parent
5f915f617e
commit
7b68420027
@ -1,10 +1,12 @@
|
|||||||
function loadMap(lvl)
|
function LoadMap(lvl)
|
||||||
|
ClearWalls()
|
||||||
|
|
||||||
local mapfilelocation = "maps/"
|
local mapfilelocation = "maps/"
|
||||||
local extention = ".lua"
|
local extention = ".lua"
|
||||||
local mapname = mapfilelocation .. "map" .. lvl .. extention
|
local mapname = mapfilelocation .. "map" .. lvl .. extention
|
||||||
|
|
||||||
GameMap = STI(mapname)
|
GameMap = STI(mapname)
|
||||||
Walls = {}
|
--Walls = {}
|
||||||
if GameMap.layers["Walls"] then
|
if GameMap.layers["Walls"] then
|
||||||
for _, obj in ipairs(GameMap.layers["Walls"].objects) do
|
for _, obj in ipairs(GameMap.layers["Walls"].objects) do
|
||||||
local wall = World:newRectangleCollider(obj.x, obj.y, obj.width, obj.height)
|
local wall = World:newRectangleCollider(obj.x, obj.y, obj.width, obj.height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user