Commit 652a04b1 authored by 18신대성's avatar 18신대성

단어 weight에 따라서 폰트 크기, 볼드여부 결정됨

parent 19715838
...@@ -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;
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n'); //alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
...@@ -23,9 +16,13 @@ class WordObject ...@@ -23,9 +16,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);
...@@ -51,7 +48,5 @@ class WordObject ...@@ -51,7 +48,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
...@@ -50,4 +50,11 @@ WordReader.getWordGrade = function(_wordTyping) ...@@ -50,4 +50,11 @@ WordReader.getWordGrade = function(_wordTyping)
return 2 <= _wordTyping && _wordTyping < 7 ? 3 : return 2 <= _wordTyping && _wordTyping < 7 ? 3 :
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