summaryrefslogtreecommitdiffhomepage
path: root/world.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-06-26 21:04:31 +0200
committerAki <nthirtyone@gmail.com>2016-06-26 21:04:31 +0200
commit71db337cb1928080f78b6b14646cce3731ecff5a (patch)
tree40c7ccfdcf28bf159fc0f1ba10b317232b00e580 /world.lua
parent7524f0e1a5ed2c1fb20201ffecb7e31c0709bb98 (diff)
downloadroflnauts-71db337cb1928080f78b6b14646cce3731ecff5a.zip
roflnauts-71db337cb1928080f78b6b14646cce3731ecff5a.tar.gz
roflnauts-71db337cb1928080f78b6b14646cce3731ecff5a.tar.bz2
Scaled background image
Diffstat (limited to 'world.lua')
-rw-r--r--world.lua16
1 files changed, 7 insertions, 9 deletions
diff --git a/world.lua b/world.lua
index 6fd5203..1e46c06 100644
--- a/world.lua
+++ b/world.lua
@@ -25,6 +25,7 @@ World = {
clouds_initial = nil,
-- Map
map = nil,
+ background = nil,
-- Gameplay status
lastNaut = false,
-- "WINNER"
@@ -94,6 +95,7 @@ function World:loadMap(name)
for _,decoration in pairs(self.map.decorations) do
self:createDecoration(decoration.x, decoration.y, decoration.sprite)
end
+ self.background = love.graphics.newImage(self.map.background)
end
-- Spawn all the nauts for the round
@@ -245,18 +247,14 @@ end
-- Draw
function World:draw()
- -- Hard-coded background (for now)
- love.graphics.setColor(self.map.color_bot)
- love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
- love.graphics.setColor(self.map.color_mid)
- love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight()*0.8)
- love.graphics.setColor(self.map.color_top)
- love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight()*0.25)
-
-- Camera stuff
local offset_x, offset_y = self.camera:getOffsets()
local scale = self.camera.scale
-
+ local scaler = self.camera.scaler
+
+ -- Background
+ love.graphics.draw(self.background, 0, 0, 0, scaler, scaler)
+
-- Draw clouds
for _,cloud in pairs(self.Clouds) do
cloud:draw(offset_x, offset_y, scale)