better wall init and clearing

main
Simon Kellet 4 months ago
parent da8bb7d083
commit f689632a92
  1. 4
      mapsloader.lua

@ -1,12 +1,10 @@
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…
Cancel
Save