From fb98ada7eb00e164d55f6a0a8a1f848059125f03 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 27 Jul 2019 11:42:37 +0200 Subject: [PATCH] feat(game/world): add invisible walls around map --- sonic-radiance.love/game/modules/world/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sonic-radiance.love/game/modules/world/init.lua b/sonic-radiance.love/game/modules/world/init.lua index a94aa44..b1ca7db 100644 --- a/sonic-radiance.love/game/modules/world/init.lua +++ b/sonic-radiance.love/game/modules/world/init.lua @@ -6,4 +6,18 @@ function RadianceWorld:new(scene, maptype, mapname) RadianceWorld.super.new(self, scene, "game.modules.world.actors", mappath, maptype) end +function RadianceWorld:loadMapObjects() + RadianceWorld.super.loadMapObjects(self) + self:addInvisibleWalls() +end + +function RadianceWorld:addInvisibleWalls() + local w, h = self:getDimensions() + print(w, h) + self.obj.collisions["invisible"](self, 0, -16, 0, w, 16, 1000) + self.obj.collisions["invisible"](self, 0, h, 0, w, 16, 1000) + self.obj.collisions["invisible"](self, w, 0, 0, 16, h, 1000) + self.obj.collisions["invisible"](self, -16, 0, 0, 16, h, 1000) +end + return RadianceWorld