diff --git a/gamecore/modules/scenes.lua b/gamecore/modules/scenes.lua index 5fbdc06..7bca6c0 100644 --- a/gamecore/modules/scenes.lua +++ b/gamecore/modules/scenes.lua @@ -64,7 +64,7 @@ function Scene:update(dt) end function Scene:updateWorld(dt) - if (self.world ~= nil) then + if (self.world ~= nil) and (self.world.isActive) then self.world:update(dt) end end diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 11b9ca0..ece92a7 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -44,6 +44,8 @@ function BaseWorld:new(scene, actorlist, mapfile) self:setGravity() self:register() + + self.isActive = true end function BaseWorld:setActorList(actorlist) @@ -275,6 +277,21 @@ function BaseWorld:getBackgroundColor() return self.backcolor[1]/256, self.backcolor[2]/256, self.backcolor[3]/256 end +-- Lock MANAGEMENT FUNCTIONS +-- Basic function to handle the lock + +function BaseWorld:setActivity(activity) + self.isActive = activity +end + +function BaseWorld:switchActivity() + self.isActive = (self.isActive == false) +end + +function BaseWorld:getActivity() + return self.isActive +end + -- UPDATE FUNCTIONS -- All update functions