Commit 2efabbbe authored by 16이지혜's avatar 16이지혜

Merge branch 'word' of https://git.kucatdog.net/tear-of-sejong/sejong25 into word

parents bb65863c 81c6b389
...@@ -7,14 +7,7 @@ class WordObject ...@@ -7,14 +7,7 @@ class WordObject
//this.wordText = Input.removeConVow(text); //this.wordText = Input.removeConVow(text);
this.wordTyping = WordReader.getWordTyping(this.wordText); this.wordTyping = WordReader.getWordTyping(this.wordText);
this.wordGrade = WordReader.getWordGrade(this.wordTyping); this.wordGrade = WordReader.getWordGrade(this.wordTyping);
this.wordWeight = (function(_wordGrade) this.wordWeight = WordReader.getWordWeight(this.wordGrade);
{
var temp = 0;
temp = _wordGrade == 3 ? 3 :
_wordGrade == 2 ? 5 :
_wordGrade == 1 ? 7 : 10;
return temp;
})(this.wordGrade);
//console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n'); //console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
this.wordSpeed = 1; this.wordSpeed = 1;
} }
...@@ -22,9 +15,13 @@ class WordObject ...@@ -22,9 +15,13 @@ class WordObject
instantiate(scene) instantiate(scene)
{ {
var random = WordSpace.getSpawnPoint(); var random = WordSpace.getSpawnPoint();
this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6)); this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBgr' + this.wordGrade + '_' + Math.min(Math.max(2, this.wordText.length), 6)).setMass(this.wordWeight);
this.physicsObj.body.bounce.set(0.5); this.wordObj = scene.add.text(random.x, random.y, this.wordText,
this.wordObj = scene.add.text(random.x, random.y, this.wordText, {fontSize: '18pt', fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000').setOrigin(0.5,0.5); {
fontSize: (this.wordWeight + 10) +'pt',
fontFamily: '"궁서", 궁서체, serif',
fontStyle: (this.wordWeight > 5 ? 'bold' : '')
}).setColor('#000000').setOrigin(0.5,0.5);
WordSpace.totalWeight += this.wordWeight; WordSpace.totalWeight += this.wordWeight;
WordSpace.setGameOverTimer(); WordSpace.setGameOverTimer();
console.log("Total weight : " + WordSpace.totalWeight); console.log("Total weight : " + WordSpace.totalWeight);
...@@ -50,7 +47,5 @@ class WordObject ...@@ -50,7 +47,5 @@ class WordObject
this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y); this.wordObj.setPosition(this.physicsObj.x, this.physicsObj.y);
} }
getWordWeight() { return this.wordWeight; }
isEqualObject(_generationCode) { return _generationCode === this.generationCode; } isEqualObject(_generationCode) { return _generationCode === this.generationCode; }
} }
\ No newline at end of file
...@@ -51,3 +51,10 @@ WordReader.getWordGrade = function(_wordTyping) ...@@ -51,3 +51,10 @@ WordReader.getWordGrade = function(_wordTyping)
7 <= _wordTyping && _wordTyping < 12 ? 2 : 7 <= _wordTyping && _wordTyping < 12 ? 2 :
12 <= _wordTyping && _wordTyping < 17 ? 1 : 0; 12 <= _wordTyping && _wordTyping < 17 ? 1 : 0;
} }
WordReader.getWordWeight = function(_wordGrade)
{
return _wordGrade == 3 ? 3 :
_wordGrade == 2 ? 5 :
_wordGrade == 1 ? 7 : 10;
}
\ No newline at end of file
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