diff options
author | Aki <nthirtyone@gmail.com> | 2016-07-20 16:04:12 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-07-20 16:04:12 +0200 |
commit | 22a1d8fcb205edd704e736b37d0ceafcc48ab72b (patch) | |
tree | 06a78ec4d3a550bde194a04291f3c6559b635489 | |
parent | f3da0bdb86df0ac0558e19df225aa8a751b6f6d2 (diff) | |
download | roflnauts-22a1d8fcb205edd704e736b37d0ceafcc48ab72b.zip roflnauts-22a1d8fcb205edd704e736b37d0ceafcc48ab72b.tar.gz roflnauts-22a1d8fcb205edd704e736b37d0ceafcc48ab72b.tar.bz2 |
Clouds toggle
-rw-r--r-- | maps/default.lua | 6 | ||||
-rw-r--r-- | world.lua | 36 |
2 files changed, 26 insertions, 16 deletions
diff --git a/maps/default.lua b/maps/default.lua index df909b4..3fc6b04 100644 --- a/maps/default.lua +++ b/maps/default.lua @@ -1,16 +1,20 @@ -- Default map from original roflnauts return { + -- CENTER AND SIZE center_x = 0, center_y = 0, width = 360, height = 240, - background = "assets/background-default.png", + -- RESPAWN POINTS respawns = { {x = -15, y = -80}, {x = -5, y = -80}, {x = 5, y = -80}, {x = 15, y = -80} }, + -- GRAPHICS + clouds = true, + background = "assets/background-default.png", platforms = { { x = -91, @@ -97,8 +97,10 @@ function World:loadMap(name) -- Background self.background = love.graphics.newImage(self.map.background) -- Clouds - for i=1,6 do - self:randomizeCloud(false) + if self.map.clouds then + for i=1,6 do + self:randomizeCloud(false) + end end end @@ -226,19 +228,21 @@ function World:update(dt) naut:update(dt) end -- Clouds - -- generator - local n = table.getn(self.Clouds) - self.clouds_delay = self.clouds_delay - dt - if self.clouds_delay < 0 and - n < 18 - then - self:randomizeCloud() - self.clouds_delay = self.clouds_delay + World.clouds_delay -- World.clouds_delay is initial - end - -- movement - for _,cloud in pairs(self.Clouds) do - if cloud:update(dt) > 340 then - table.remove(self.Clouds, _) + if self.map.clouds then + -- generator + local n = table.getn(self.Clouds) + self.clouds_delay = self.clouds_delay - dt + if self.clouds_delay < 0 and + n < 18 + then + self:randomizeCloud() + self.clouds_delay = self.clouds_delay + World.clouds_delay -- World.clouds_delay is initial + end + -- movement + for _,cloud in pairs(self.Clouds) do + if cloud:update(dt) > 340 then + table.remove(self.Clouds, _) + end end end -- Effects @@ -275,6 +279,8 @@ function World:draw() -- Background love.graphics.draw(self.background, 0, 0, 0, scaler, scaler) + + -- This needs to be reworked! -- Draw clouds for _,cloud in pairs(self.Clouds) do cloud:draw(offset_x, offset_y, scale) |