diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-13 05:03:23 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-13 05:03:23 +0200 |
commit | b7af282afe5de671bbd0e72099d8f063ef65b71a (patch) | |
tree | ab40768b838221a485370d98b3fe7c2f39bcae1e /not | |
parent | 4e3b4358bb3f8280a4739bf6a110823b029acae2 (diff) | |
download | roflnauts-b7af282afe5de671bbd0e72099d8f063ef65b71a.zip roflnauts-b7af282afe5de671bbd0e72099d8f063ef65b71a.tar.gz roflnauts-b7af282afe5de671bbd0e72099d8f063ef65b71a.tar.bz2 |
Clouds now generates a little bit less often and timer won't go down much below 0
Diffstat (limited to 'not')
-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 |