diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 9ba876c..4bf83eb 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -35,14 +35,16 @@ local PADDING_VALUE = 10/100 -- All functions to init the world and the map function BaseWorld:new(scene, actorlist, mapfile) - self.scene = scene + self.scene = scene + self.actorlist = actorlist + self.mapfile = mapfile self.cameras = CameraSystem(self) self:initActors() self:initPlayers() - self:setActorList(actorlist) - self:initMap(mapfile) + self:setActorList(self.actorlist) + self:initMap(self.mapfile) self:setGravity() self:register() @@ -79,6 +81,16 @@ function BaseWorld:register() self.scene:registerWorld(self) end +function BaseWorld:reset() + self:initActors() + self:initPlayers() + self:initMap(self.mapfile) + self.cameras:initViews() + collectgarbage() + + self:loadMap() +end + -- ACTOR MANAGEMENT FUNCTIONS -- Basic function to handle actors