summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-13 03:55:59 +0200
committerAki <nthirtyone@gmail.com>2017-09-13 03:55:59 +0200
commitf15ace4d5b9f62b6288a2b6750bc48159ebebe00 (patch)
tree217aae396c673cc3a037207ec9cb3587f6965f7b
parent534f8f925a5fe389fec15d147b495c416b5b7e77 (diff)
downloadroflnauts-f15ace4d5b9f62b6288a2b6750bc48159ebebe00.zip
roflnauts-f15ace4d5b9f62b6288a2b6750bc48159ebebe00.tar.gz
roflnauts-f15ace4d5b9f62b6288a2b6750bc48159ebebe00.tar.bz2
CloudGenerator is now treated as Entity
-rw-r--r--config/maps/default.lua4
-rw-r--r--not/World.lua15
2 files changed, 6 insertions, 13 deletions
diff --git a/config/maps/default.lua b/config/maps/default.lua
index a11c503..ebfcbb8 100644
--- a/config/maps/default.lua
+++ b/config/maps/default.lua
@@ -12,9 +12,11 @@ return
{x = 5, y = -80},
{x = 15, y = -80}
},
- clouds = true,
create = {
{
+ clouds = true
+ },
+ {
ratio = 0,
background = "assets/backgrounds/default.png"
},
diff --git a/not/World.lua b/not/World.lua
index 2a7437f..5d46b5b 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -24,7 +24,6 @@ function World:new (map, nauts)
self:initLayers()
self:buildMap()
- self:initClouds()
self:spawnNauts(nauts)
self.camera = Camera(self.map.center.x, self.map.center.y, self)
@@ -97,13 +96,9 @@ function World:buildMap ()
end
bg.layer = self:addLayer(width, height, op.ratio)
end
- end
-end
-
-function World:initClouds ()
- if self.map.clouds then
- self.cloudGenerator = CloudGenerator(self)
- self.cloudGenerator:run(6, true)
+ if op.clouds then
+ self:insertEntity(CloudGenerator(self)):run(6, true)
+ end
end
end
@@ -265,10 +260,6 @@ function World:update (dt)
self.world:update(dt)
self.camera:update(dt)
- if self.cloudGenerator then
- self.cloudGenerator:update(dt)
- end
-
for key,entity in pairs(self.entities) do
if entity:update(dt) then
table.remove(self.entities, key):delete()