scenes/levels: don't access directly the map object
This commit is contained in:
parent
581fd9952e
commit
e332b1c214
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue