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()
|
function Player:getViewCenter()
|
||||||
local x, y = Player.super.getViewCenter(self)
|
local x, y = Player.super.getViewCenter(self)
|
||||||
return x, y-16
|
return self.world:getViewCenter(x, y)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Player:draw()
|
function Player:draw()
|
||||||
|
|
|
@ -30,6 +30,10 @@ function ParentWorld:addInvisibleWalls()
|
||||||
self.obj.collisions["invisible"](self, -16, 0, 0, 16, h, 1000)
|
self.obj.collisions["invisible"](self, -16, 0, 0, 16, h, 1000)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ParentWorld:getViewCenter(x, y)
|
||||||
|
return x, y-16
|
||||||
|
end
|
||||||
|
|
||||||
function ParentWorld:draw(dt)
|
function ParentWorld:draw(dt)
|
||||||
self:drawBackgroundColor()
|
self:drawBackgroundColor()
|
||||||
local camNumber = self.cameras:getViewNumber()
|
local camNumber = self.cameras:getViewNumber()
|
||||||
|
|
|
@ -10,6 +10,10 @@ function ShootWorld:new(scene, mapname)
|
||||||
self.mapname = mapname
|
self.mapname = mapname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ShootWorld:getViewCenter(x, y)
|
||||||
|
return x+128, y-16
|
||||||
|
end
|
||||||
|
|
||||||
function ShootWorld:createMapController()
|
function ShootWorld:createMapController()
|
||||||
self.customMap.Shoot(self, self.maptype, self.mapname)
|
self.customMap.Shoot(self, self.maptype, self.mapname)
|
||||||
self.cameras:lockY(10)
|
self.cameras:lockY(10)
|
||||||
|
|
|
@ -35,9 +35,9 @@ function MovePlayer:new(playerNumber, cameraMode)
|
||||||
MovePlayer.super.new(self)
|
MovePlayer.super.new(self)
|
||||||
self.assets:batchImport("scenes.test_scene.assets")
|
self.assets:batchImport("scenes.test_scene.assets")
|
||||||
|
|
||||||
--ShootWorld(self, "coast")
|
ShootWorld(self, "coast")
|
||||||
--BattleWorld(self, "ebeach")
|
--BattleWorld(self, "ebeach")
|
||||||
TestWorld(self)
|
--TestWorld(self)
|
||||||
|
|
||||||
self.world:setPlayerNumber(playerNumber)
|
self.world:setPlayerNumber(playerNumber)
|
||||||
self.world.cameras:setMode(cameraMode)
|
self.world.cameras:setMode(cameraMode)
|
||||||
|
|
Loading…
Reference in a new issue