summaryrefslogtreecommitdiffhomepage
path: root/not/World.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-13 04:53:00 +0200
committerAki <nthirtyone@gmail.com>2017-09-13 04:53:00 +0200
commit4e3b4358bb3f8280a4739bf6a110823b029acae2 (patch)
tree6dee889bb8ec230446378e9cd6170afe08926802 /not/World.lua
parenta0bbf9f36db30b0c6de3480f525ee69698ba18f9 (diff)
downloadroflnauts-4e3b4358bb3f8280a4739bf6a110823b029acae2.zip
roflnauts-4e3b4358bb3f8280a4739bf6a110823b029acae2.tar.gz
roflnauts-4e3b4358bb3f8280a4739bf6a110823b029acae2.tar.bz2
CloudGenerators now can be configured to use layer with ratio
Diffstat (limited to 'not/World.lua')
-rw-r--r--not/World.lua9
1 files changed, 8 insertions, 1 deletions
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