diff options
author | Aki <nthirtyone@gmail.com> | 2016-06-26 21:04:31 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-06-26 21:04:31 +0200 |
commit | 71db337cb1928080f78b6b14646cce3731ecff5a (patch) | |
tree | 40c7ccfdcf28bf159fc0f1ba10b317232b00e580 /world.lua | |
parent | 7524f0e1a5ed2c1fb20201ffecb7e31c0709bb98 (diff) | |
download | roflnauts-71db337cb1928080f78b6b14646cce3731ecff5a.zip roflnauts-71db337cb1928080f78b6b14646cce3731ecff5a.tar.gz roflnauts-71db337cb1928080f78b6b14646cce3731ecff5a.tar.bz2 |
Scaled background image
Diffstat (limited to 'world.lua')
-rw-r--r-- | world.lua | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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) |