From ee6ac56eea149c49f586f143dd0270b2950bfae6 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 12 Jul 2019 23:28:06 +0200 Subject: [PATCH] feat(examples): make player number and camera mode customizable --- examples/gameplay/moveplayer/init.lua | 8 ++++++-- examples/gameplay/moveplayer3D/init.lua | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/gameplay/moveplayer/init.lua b/examples/gameplay/moveplayer/init.lua index 19e39e8..02a871a 100644 --- a/examples/gameplay/moveplayer/init.lua +++ b/examples/gameplay/moveplayer/init.lua @@ -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 diff --git a/examples/gameplay/moveplayer3D/init.lua b/examples/gameplay/moveplayer3D/init.lua index 55f9789..cf553bd 100644 --- a/examples/gameplay/moveplayer3D/init.lua +++ b/examples/gameplay/moveplayer3D/init.lua @@ -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)