feat(examples): make player number and camera mode customizable

This commit is contained in:
Kazhnuz 2019-07-12 23:28:06 +02:00
parent 342d073572
commit ee6ac56eea
2 changed files with 13 additions and 4 deletions

View file

@ -26,12 +26,16 @@ local MovePlayer = Scene:extend()
local World = require "gamecore.modules.world.world2D"
function MovePlayer:new()
function MovePlayer:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
local cameraMode = cameraMode or "split"
MovePlayer.super.new(self)
World(self, "examples.gameplay.moveplayer.actors", "examples/gameplay/moveplayer/assets/arena.lua")
self.world:setPlayerNumber(4)
self.world:setPlayerNumber(playerNumber)
self.world.cameras:setMode(cameraMode)
self.world:loadMap()
end

View file

@ -26,12 +26,17 @@ local MovePlayer = Scene:extend()
local World = require "gamecore.modules.world.world3D"
function MovePlayer:new()
function MovePlayer:new(playerNumber, cameraMode)
local playerNumber = playerNumber or 1
local cameraMode = cameraMode or "split"
MovePlayer.super.new(self)
self.assets:batchImport("examples.gameplay.plateform.assets")
World(self, "examples.gameplay.moveplayer3D.actors", "examples/gameplay/moveplayer3D/assets/arena.lua")
self.world:setPlayerNumber(1)
self.world:setPlayerNumber(playerNumber)
self.world.cameras:setMode(cameraMode)
self.world:loadMap()
self.world.obj.collisions["wall"](self.world, 0,0,-16,1000, 1000, 16)