From b7af282afe5de671bbd0e72099d8f063ef65b71a Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 13 Sep 2017 05:03:23 +0200 Subject: Clouds now generates a little bit less often and timer won't go down much below 0 --- not/CloudGenerator.lua | 13 ++++++++----- 1 file 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 -- cgit v1.1