diff options
Diffstat (limited to 'not')
-rw-r--r-- | not/CloudGenerator.lua | 4 | ||||
-rw-r--r-- | not/World.lua | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/not/CloudGenerator.lua b/not/CloudGenerator.lua index 36ec70f..75fd180 100644 --- a/not/CloudGenerator.lua +++ b/not/CloudGenerator.lua @@ -9,8 +9,9 @@ function CloudGenerator:new (atlas, animations, count, world) self.atlas = atlas self.quads = animations self.count = count - self.interval = 6 + self.interval = 8 self.timer = 0 + self.layer = false end -- TODO: This was a bad idea. Move Cloud creation back to World, pass created Cloud here for configuration. @@ -21,6 +22,7 @@ function CloudGenerator:createCloud (x, y, style) cloud:setVelocity(13, 0) cloud:setBoundary(340, 320) cloud.generator = self + cloud.layer = self.layer return cloud end diff --git a/not/World.lua b/not/World.lua index f576fca..5492c76 100644 --- a/not/World.lua +++ b/not/World.lua @@ -75,6 +75,7 @@ function World:initLayers () end --- Builds map using one of tables frin config files located in `config/maps/` directory. +-- TODO: Clean World@buildMap. Possibly explode into more methods. function World:buildMap () for _,op in pairs(self.map.create) do if op.platform then @@ -97,11 +98,15 @@ function World:buildMap () bg.layer = self:addLayer(width, height, op.ratio) end if op.clouds then + local width, height = love.graphics.getDimensions() local animations = op.animations if type(animations) == "string" then animations = require("config.animations." .. animations) end local cg = CloudGenerator(op.clouds, animations, op.count, self) + if op.ratio then + cg.layer = self:addLayer(width, height, op.ratio) + end self:insertEntity(cg) cg:run(op.count, true) end @@ -177,7 +182,9 @@ end function World:insertCloud (cloud) table.insert(self.entities, cloud) - cloud.layer = self.layers.clouds + if not cloud.layer then + cloud.layer = self.layers.clouds + end return cloud end |