From 4e3b4358bb3f8280a4739bf6a110823b029acae2 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 13 Sep 2017 04:53:00 +0200 Subject: CloudGenerators now can be configured to use layer with ratio --- not/World.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'not/World.lua') 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 -- cgit v1.1