feat: make some camera elements world-dependant
This commit is contained in:
parent
9b16ae4429
commit
97b3bcf80f
4 changed files with 11 additions and 3 deletions
|
@ -83,7 +83,7 @@ end
|
|||
|
||||
function Player:getViewCenter()
|
||||
local x, y = Player.super.getViewCenter(self)
|
||||
return x, y-16
|
||||
return self.world:getViewCenter(x, y)
|
||||
end
|
||||
|
||||
function Player:draw()
|
||||
|
|
|
@ -30,6 +30,10 @@ function ParentWorld:addInvisibleWalls()
|
|||
self.obj.collisions["invisible"](self, -16, 0, 0, 16, h, 1000)
|
||||
end
|
||||
|
||||
function ParentWorld:getViewCenter(x, y)
|
||||
return x, y-16
|
||||
end
|
||||
|
||||
function ParentWorld:draw(dt)
|
||||
self:drawBackgroundColor()
|
||||
local camNumber = self.cameras:getViewNumber()
|
||||
|
|
|
@ -10,6 +10,10 @@ function ShootWorld:new(scene, mapname)
|
|||
self.mapname = mapname
|
||||
end
|
||||
|
||||
function ShootWorld:getViewCenter(x, y)
|
||||
return x+128, y-16
|
||||
end
|
||||
|
||||
function ShootWorld:createMapController()
|
||||
self.customMap.Shoot(self, self.maptype, self.mapname)
|
||||
self.cameras:lockY(10)
|
||||
|
|
|
@ -35,9 +35,9 @@ function MovePlayer:new(playerNumber, cameraMode)
|
|||
MovePlayer.super.new(self)
|
||||
self.assets:batchImport("scenes.test_scene.assets")
|
||||
|
||||
--ShootWorld(self, "coast")
|
||||
ShootWorld(self, "coast")
|
||||
--BattleWorld(self, "ebeach")
|
||||
TestWorld(self)
|
||||
--TestWorld(self)
|
||||
|
||||
self.world:setPlayerNumber(playerNumber)
|
||||
self.world.cameras:setMode(cameraMode)
|
||||
|
|
Loading…
Reference in a new issue