diff options
Diffstat (limited to 'not/CloudGenerator.lua')
-rw-r--r-- | not/CloudGenerator.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/not/CloudGenerator.lua b/not/CloudGenerator.lua index 75fd180..f9eaf40 100644 --- a/not/CloudGenerator.lua +++ b/not/CloudGenerator.lua @@ -9,8 +9,8 @@ function CloudGenerator:new (atlas, animations, count, world) self.atlas = atlas self.quads = animations self.count = count - self.interval = 8 - self.timer = 0 + self.interval = 12 + self.timer = self.interval self.layer = false end @@ -50,6 +50,7 @@ end function CloudGenerator:run (count, inside) count = count or 1 + print(self, "spawning", count) for i=1,count do local x, y = self:getRandomPosition(inside) local style = self:getRandomStyle() @@ -59,9 +60,11 @@ end function CloudGenerator:update (dt) local count = self.world:getCloudsCountFrom(self) - if self.timer < 0 and self.count > count then - self.timer = self.timer + self.interval - self:run() + if self.timer < 0 then + if self.count > count then + self.timer = self.timer + self.interval + self:run() + end else self.timer = self.timer - dt end |