Commit c4dc8f1c authored by 18손재민's avatar 18손재민 Committed by 18신대성

이제 호패 위치가 랜덤하게, 호패 길이에 따라 균일하게 쌓임

parent 89b6ee4c
......@@ -42,7 +42,7 @@ var gameScene = new Phaser.Class(
Input.inputField.loadImage(this);
CSVParsing.loadText(this);
},
create: function()
{
CSVParsing.CSVParse(this);
......@@ -76,20 +76,21 @@ var gameScene = new Phaser.Class(
}
});
console.log(RoomData.myself);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.generateWord.Name(this, false);
WordSpace.test = WordSpace.generateWord.Name(this, false, null);
console.log('1' + WordSpace.test.physicsObj.body.width);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.generateWord.Name(this, false, null);
WordSpace.attackGauge.add(5);
},
update: function()
......
......@@ -37,7 +37,6 @@ class WordObject
.setFrictionY(0)
.setBounce(0.5);
}
this.physicsObj.wordCollider = null;
let dist = Phaser.Math.Distance.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y);
let angle = Phaser.Math.Angle.Between(this.physicsObj.x, this.physicsObj.y, WordSpace.gravityPoint.x, WordSpace.gravityPoint.y);
......@@ -62,7 +61,7 @@ class WordObject
destroy()
{
console.log(this.generationCode + ': ' + this.wordText + ' destroyed');
//console.log(this.generationCode + ': ' + this.wordText + ' destroyed');
WordSpace.totalWeight -= this.wordWeight;
WordSpace.totalWordNum -= 1;
WordSpace.resetGameOverTimer();
......@@ -177,7 +176,7 @@ class NameWord extends WordObject
this.wordWeight = 2;
this.isStrong = _isStrong;
this.isActive = true;
console.log('Name : ' + player.nickname + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
//console.log('Name : ' + player.nickname + ', Strong : ' + this.isStrong + ', Weight : ' + this.wordWeight);
}
attract()
{
......@@ -202,23 +201,22 @@ class NameWord extends WordObject
object1.topObj.attract();
});
});
WordSpace.attackGauge.add(this.wordTyping * 0.1);
if(!this.isStrong) WordSpace.attackGauge.add(this.wordTyping * 0.1);
WordSpace.nameGroup.push(this);
this.isActive = false;
this.physicsObj.setVelocity(0, 0).setDepth(2);
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y).setDepth(2);
this.follower = { t: 0, vec: new Phaser.Math.Vector2() };
this.path = new Phaser.Curves.Spline([
this.physicsObj.x, this.physicsObj.y,
(this.physicsObj.x + 500 + WordSpace.nameGroup.length * 25) / 2, this.physicsObj.y - 50,
500 + WordSpace.nameGroup.length * 25, 650
(this.physicsObj.x + 500 + WordSpace.nameGroup.length * 15) / 2, this.physicsObj.y - 50,
500 + WordSpace.nameGroup.length * 15, 680 + this.wordText.length * 10 + (Math.random() * 20 - 10)
]);
WordSpace.gameSceneForTest.tweens.add({
targets: this.follower,
t: 1,
ease: 'Sine',
duration: 4000,
duration: 2000,
repeat: 0
});
......
var WordSpace = WordSpace || {};
WordSpace.test = null;
// for test
WordSpace.gameSceneForTest = null;
WordSpace.weightTextObjForTest = null;
......@@ -69,7 +71,7 @@ WordSpace.gameOverCycle = new Cycle(gameOver);
//호패 생성 사이클
WordSpace.nameCycle = new Cycle(function()
{
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false);
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false, null);
});
//이건 뭐지
WordSpace.varAdjustCycle = new Cycle(function()
......@@ -247,17 +249,21 @@ WordSpace.generateWord =
{
word = new NormalWord(SelectWord.selectWord(grade));
WordSpace.pushWord(scene, word, lenRate);
return word;
},
Attack: function(scene, wordText, grade, attacker, isStrong, lenRate)
{
word = new AttackWord(wordText, grade, attacker, isStrong);
WordSpace.pushWord(scene, word, lenRate);
return word;
},
Name: function(scene, isStrong, lenRate)
Name: function(scene, isStrong, newPlayerData, lenRate)
{
word = new NameWord(WordSpace.nameQueue.pop(), isStrong);
if(newPlayerData == null) word = new NameWord(WordSpace.nameQueue.pop(), isStrong);
else word = new NameWord(newPlayerData, isStrong);
//word = new NameWord(RoomData.myself, false);
WordSpace.pushWord(scene, word, lenRate);
return word;
}
}
......@@ -352,7 +358,7 @@ WordSpace.findWord = function(wordText)
if(tempDist <= minDist) minDist = tempDist;
}
});
attackWords.forEach(function(element)
attackWords.some(function(element)
{
if(WordSpace.getEditDistance(wordText, element.wordText) == minDist)
{
......@@ -364,6 +370,7 @@ WordSpace.findWord = function(wordText)
target: element.attacker.idNum
}
socket.emit('defenseFailed', victimData);
return true;
}
});
this.attackGauge.sub(2);
......@@ -410,8 +417,8 @@ WordSpace.attack = function(wordText, grade)
});
//테스트용, 자기 자신에게 공격함
//WordSpace.generateWord.Attack(WordSpace.gameSceneForTest, wordText, grade, PlayerData, false);
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false);
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false);
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false, null);
WordSpace.generateWord.Name(WordSpace.gameSceneForTest, false, null);
WordSpace.nameGroup = [];
WordSpace.attackGauge.resetValue();
......
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