Commit 767e7af6 authored by 18손재민's avatar 18손재민

이제 호패를 입력하면 호패가 하단에 쌓이고, 공격하면 호패가 사라짐. 강호패는 wip

parent de364cdb
var GameServer = GameServer || {};
GameServer.Phase = {READY: 0, START: 1, MAIN: 2, MUSIC: 3};
GameServer.startCount = 4;
GameServer.startCount = 2;
GameServer.currentPlayer = [];
GameServer.playingRoom = [];
......
......@@ -53,6 +53,7 @@ socket.on('defeat', function(msg) // object player
socket.on('attackSucceed', function(msg)
{
WordSpace.nameGroup.push(new NameWord(msg.victim, true));
});
......
......@@ -172,12 +172,30 @@ class NameWord extends WordObject
this.ownerId = player.id;
this.wordWeight = 2;
this.isStrong = _isStrong;
this.isActive = true;
console.log('Name : ' + player.nickname + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
}
attract()
{
if(this.isActive) super.attract();
}
destroy()
{
WordSpace.attackGauge.add(this.wordTyping * 0.1);
WordSpace.nameGroup.push(this);
super.destroy();
this.isActive = false;
this.physicsObj.setVelocity(0, 0);
this.physicsObj.setPosition(100 + WordSpace.nameGroup.length * 50, 650).setDepth(2);
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y).setDepth(2);
console.log(this.generationCode + ': ' + this.wordText + ' destroyed');
WordSpace.totalWeight -= this.wordWeight;
WordSpace.totalWordNum -= 1;
WordSpace.resetGameOverTimer();
const groupIdx = WordSpace.wordGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this);
if (groupIdx > -1) WordSpace.wordGroup.splice(groupIdx, 1);
const forceIdx = WordSpace.wordForcedGroup.findIndex(function(item) {return this.isEqualObject(item.generationCode)}, this);
if (forceIdx > -1) WordSpace.wordForcedGroup.splice(forceIdx, 1);
//WordSpace.wordPhysicsGroup.remove(this.physicsObj, true, true);
}
}
......@@ -403,6 +403,8 @@ WordSpace.attack = function(wordText, grade)
isStrong: element.isStrong
}
socket.emit('attack', attackData);
element.physicsObj.destroy();
element.wordObj.destroy();
});
//테스트용, 자기 자신에게 공격함
//WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData, false);
......
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