feat: make some camera elements world-dependant

This commit is contained in:
Kazhnuz 2019-12-28 14:17:58 +01:00
parent 9b16ae4429
commit 97b3bcf80f
4 changed files with 11 additions and 3 deletions

View file

@ -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()

View file

@ -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()

View file

@ -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)

View file

@ -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)