Commit a9949132 authored by 18손재민's avatar 18손재민 Committed by 18류지석

다른 플레이어의 닉네임도 같이 표시함

parent 0cca4b1d
......@@ -22,13 +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);
BackGround.characterPos = BackGround.characterPos.sort(function(){return 0.5-Math.random()});
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.otherCharacters[BackGround.otherCharacters.length - 1].nicknameText = scene.add.text(element.position.x, element.position.y - 90, element.nickname)
.setOrigin(0.5,0.5).setColor('#000000').setPadding(0.5,0.5,0.5,0.5).setDepth(1);
}
});
}
......
......@@ -425,17 +425,11 @@ WordSpace.nameQueue =
queue: [],
shuffle: function()
{
let tempIdx, tempElement, tempLength, tempQueue = [];
let tempQueue = [];
RoomData.players.forEach(function(element){
tempQueue.push(element.index)
})
for(tempLength = tempQueue.length; tempLength; tempLength -= 1)
{
tempIdx = Math.floor(Math.random() * tempLength);
tempElement = tempQueue[tempLength - 1];
tempQueue[tempLength - 1] = tempQueue[tempIdx];
tempQueue[tempIdx] = tempElement;
}
tempQueue.sort(function(){return 0.5-Math.random()});
tempQueue.forEach(function(element)
{
if(RoomData.players[element].id != PlayerData.id && RoomData.players[element].isAlive)
......
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