feat(world): add a function to reset world
This commit is contained in:
parent
fb35eca0fa
commit
a227bbb033
1 changed files with 15 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue