scenes/levels: add more map-related function to world.lua

This commit is contained in:
Kazhnuz 2019-03-03 13:30:52 +01:00
parent 61f15d6f67
commit ecaabd4814
2 changed files with 17 additions and 17 deletions

View File

@ -119,23 +119,6 @@ function Level:draw(dt)
self:drawDebugHUD()
end
function Level:drawMap()
local tx = self.camera.x - 424 / 2
local ty = self.camera.y - 240 / 2
tx = math.floor(tx)
ty = math.floor(ty)
self.map:draw(-tx, -ty, self.camera.scale, self.camera.scale)
end
function Level:drawBackgroundColor()
local r, g, b = self.backcolor[1], self.backcolor[2], self.backcolor[3]
love.graphics.setColor(r/256, g/256, b/256)
love.graphics.rectangle("fill", 0, 0, 480, 272)
utils.graphics.resetColor()
end
function Level:drawHUD(dt)
utils.graphics.resetColor()
local hp = 0

View File

@ -135,3 +135,20 @@ end
function Level:getEntities()
return self.entities:getItems()
end
function Level:drawMap()
local tx = self.camera.x - 424 / 2
local ty = self.camera.y - 240 / 2
tx = math.floor(tx)
ty = math.floor(ty)
self.map:draw(-tx, -ty, self.camera.scale, self.camera.scale)
end
function Level:drawBackgroundColor()
local r, g, b = self.backcolor[1], self.backcolor[2], self.backcolor[3]
love.graphics.setColor(r/256, g/256, b/256)
love.graphics.rectangle("fill", 0, 0, 480, 272)
utils.graphics.resetColor()
end