diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-03 02:03:42 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-03 02:03:42 +0200 |
commit | 1b7f0c58c0090a1ccab884b84156fa19a8e4747a (patch) | |
tree | 5882d2364c25faff1dac26785545e49c5f615cc7 /not/World.lua | |
parent | d2ba9f3c87589f167e715b17f6740977e1c29dff (diff) | |
download | roflnauts-1b7f0c58c0090a1ccab884b84156fa19a8e4747a.zip roflnauts-1b7f0c58c0090a1ccab884b84156fa19a8e4747a.tar.gz roflnauts-1b7f0c58c0090a1ccab884b84156fa19a8e4747a.tar.bz2 |
Background as Decoration, no layers with scroll ratio yet
Diffstat (limited to 'not/World.lua')
-rw-r--r-- | not/World.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/not/World.lua b/not/World.lua index 8a6ba09..6a71fd9 100644 --- a/not/World.lua +++ b/not/World.lua @@ -44,8 +44,7 @@ function World:delete () self.world:destroy() end --- Load map from file --- TODO: Change current map model to function-based one. +--- Loads table from selected map config file located in `config/maps/` directory. function World:loadMap (name) local map = string.format("config/maps/%s.lua", name or "default") self.map = love.filesystem.load(map)() @@ -60,7 +59,10 @@ function World:loadMap (name) self:createDecoration(op.x, op.y, op.decoration) end if op.background then - self.background = love.graphics.newImage(op.background) + local image = love.graphics.newImage(op.background) + local x = image:getWidth() / -2 + local y = image:getHeight() / -2 + self:createDecoration(x, y, op.background) -- TODO: Decoration does not allow Image instead of filePath! end end @@ -245,7 +247,7 @@ function World:draw () local scaler = getRealScale() -- Background - love.graphics.draw(self.background, 0, 0, 0, scaler, scaler) + -- love.graphics.draw(self.background, 0, 0, 0, scaler, scaler) -- TODO: this needs to be reworked! -- Draw clouds |