summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--not/CloudGenerator.lua3
-rw-r--r--not/World.lua6
2 files changed, 8 insertions, 1 deletions
diff --git a/not/CloudGenerator.lua b/not/CloudGenerator.lua
index e9d8ed7..36ec70f 100644
--- a/not/CloudGenerator.lua
+++ b/not/CloudGenerator.lua
@@ -20,6 +20,7 @@ function CloudGenerator:createCloud (x, y, style)
cloud:setAnimation(style)
cloud:setVelocity(13, 0)
cloud:setBoundary(340, 320)
+ cloud.generator = self
return cloud
end
@@ -55,7 +56,7 @@ function CloudGenerator:run (count, inside)
end
function CloudGenerator:update (dt)
- local count = self.world:getCloudsCount()
+ local count = self.world:getCloudsCountFrom(self)
if self.timer < 0 and self.count > count then
self.timer = self.timer + self.interval
self:run()
diff --git a/not/World.lua b/not/World.lua
index 853d75b..f576fca 100644
--- a/not/World.lua
+++ b/not/World.lua
@@ -222,6 +222,12 @@ function World:getCloudsCount ()
end)
end
+function World:getCloudsCountFrom (generator)
+ return self:countEntities(function (entity)
+ return entity:is(Cloud) and entity.generator == generator
+ end)
+end
+
function World:getNautsAll ()
return self:getEntities(function (entity)
return entity:is(require("not.Hero")) and not entity.body:isDestroyed()