Commit 0cca4b1d authored by 18손재민's avatar 18손재민

다른 플레이어 수에 따라 임의의 위치에 플레이어 이미지를 띄움

parent 1cfc871e
......@@ -287,6 +287,7 @@ class Player
this.gameRoomId = gameRoom.roomId;
this.index = gameRoom.currentPlayer.length;
this.nickname = playerData.nickname;
this.position = null;
this.isAlive = true;
this.rank = -1;
......
......@@ -2,6 +2,15 @@ var BackGround = BackGround || {}
BackGround.brainGroup = null;
BackGround.myCharacter = null;
BackGround.characterPos = [
new Phaser.Math.Vector2(100, 99), new Phaser.Math.Vector2(248, 198), new Phaser.Math.Vector2(412, 144), new Phaser.Math.Vector2(124, 393),
new Phaser.Math.Vector2(368, 336), new Phaser.Math.Vector2(272, 453), new Phaser.Math.Vector2(100, 595), new Phaser.Math.Vector2(284, 678),
new Phaser.Math.Vector2(444, 639), new Phaser.Math.Vector2(116, 799), new Phaser.Math.Vector2(413, 789), new Phaser.Math.Vector2(280, 916),
new Phaser.Math.Vector2(1437, 157), new Phaser.Math.Vector2(1672, 95), new Phaser.Math.Vector2(1832, 166), new Phaser.Math.Vector2(1581, 239),
new Phaser.Math.Vector2(1779, 311), new Phaser.Math.Vector2(1595, 414), new Phaser.Math.Vector2(1774, 480), new Phaser.Math.Vector2(1501, 563),
new Phaser.Math.Vector2(1736, 655), new Phaser.Math.Vector2(1446, 770), new Phaser.Math.Vector2(1656, 894), new Phaser.Math.Vector2(1826, 819),
]
BackGround.otherCharacters = [];
BackGround.loadImage = function(scene)
{
......@@ -13,6 +22,15 @@ BackGround.loadImage = function(scene)
BackGround.drawCharacter = function(scene)
{
BackGround.myCharacter = scene.add.sprite(game.config.width / 2, game.config.height * 41 / 48, 'pyeongminWrite').setScale(0.45).setDepth(2);
BackGround.characterPos = Phaser.Utils.Array.Shuffle(BackGround.characterPos);
RoomData.players.forEach(function(element){
if(element.id != RoomData.myself.id)
{
element.position = BackGround.characterPos.pop();
BackGround.otherCharacters.push(scene.add.sprite(element.position.x, element.position.y, 'pyeongminWrite').setScale(0.45).setDepth(1));
BackGround.otherCharacters[BackGround.otherCharacters.length - 1].flipX = element.position.x < game.config.width / 2 ? true : false;
}
});
}
BackGround.drawBrain = function(scene)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment