summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--maps/default.lua6
-rw-r--r--world.lua36
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,
diff --git a/world.lua b/world.lua
index 09966f3..bd3b392 100644
--- a/world.lua
+++ b/world.lua
@@ -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)