scenes/levels: don't access directly the map object

This commit is contained in:
Kazhnuz 2019-03-03 13:57:40 +01:00
parent 581fd9952e
commit e332b1c214
2 changed files with 4 additions and 3 deletions

View File

@ -67,8 +67,7 @@ function Level:limitCamera()
local camx, camy = self.camera.x, self.camera.y
local camMinX, camMinY = (self.screenWidth/2), (self.screenHeight/2)
local camMaxX, camMaxY = self.map.width * self.map.tilewidth,
self.map.height * self.map.tileheight
local camMaxX, camMaxY = self:getDimensions()
if (self.resolution == 1) then
camMaxX, camMaxY = camMaxX - camMinX, camMaxY - camMinY

View File

@ -128,7 +128,9 @@ function Player:update(dt)
self:getDirection()
if self.y >= ((self.level.map.height * self.level.map.tileheight) + 64) then
local _, height = self.world:getDimensions()
if self.y >= (height + 64) then
self:die()
end
end