Commit 41957eca authored by 18신대성's avatar 18신대성 Committed by 16이지혜

간이 공격모드 구현

parent 1380672f
...@@ -7,6 +7,8 @@ Input.isShifted = false; ...@@ -7,6 +7,8 @@ Input.isShifted = false;
Input.pressCount = 0; Input.pressCount = 0;
Input.justPressed = ''; Input.justPressed = '';
Input.attackMode = false;
Input.reset = function() Input.reset = function()
{ {
Input.input = []; Input.input = [];
...@@ -150,7 +152,7 @@ Input.convert = function() ...@@ -150,7 +152,7 @@ Input.convert = function()
} }
} }
} }
console.log('_____end_convert_____'); //console.log('_____end_convert_____');
} }
Input.convertToLast = function(word) Input.convertToLast = function(word)
...@@ -278,7 +280,8 @@ Input.inputField = ...@@ -278,7 +280,8 @@ Input.inputField =
}); });
scene.input.keyboard.on('keydown-ENTER', function() scene.input.keyboard.on('keydown-ENTER', function()
{ {
WordSpace.findWord(Input.convInput); if (Input.attackMode) WordSpace.attack(Input.convInput);
else WordSpace.findWord(Input.convInput);
Input.reset(); Input.reset();
}); });
// upside 10 keys // upside 10 keys
...@@ -339,7 +342,7 @@ Input.pushInput = function(inputKey) ...@@ -339,7 +342,7 @@ Input.pushInput = function(inputKey)
} }
else output = inputKey.charCodeAt(0); else output = inputKey.charCodeAt(0);
Input.input.push(output); Input.input.push(output);
console.log(Input.input ); //console.log(Input.input);
Input.convert(); Input.convert();
Input.inputField.text.setText(Input.convInput); Input.inputField.text.setText(Input.convInput);
this.pressCount++; this.pressCount++;
......
...@@ -15,9 +15,6 @@ class WordObject ...@@ -15,9 +15,6 @@ class WordObject
_wordGrade == 1 ? 7 : 10; _wordGrade == 1 ? 7 : 10;
return temp; return temp;
})(this.wordGrade); })(this.wordGrade);
WordSpace.totalWeight += this.wordWeight;
WordSpace.setGameOverTimer();
console.log("Total weight : " + WordSpace.totalWeight);
//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');
...@@ -29,6 +26,9 @@ class WordObject ...@@ -29,6 +26,9 @@ class WordObject
this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBackground').setScale(0.3); this.physicsObj = scene.physics.add.sprite(random.x, random.y, 'wordBackground').setScale(0.3);
this.physicsObj.body.bounce.set(0.5); this.physicsObj.body.bounce.set(0.5);
this.wordObj = scene.add.text(random.x, random.y, this.wordText, {fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000').setOrigin(0.5,0.5); this.wordObj = scene.add.text(random.x, random.y, this.wordText, {fontFamily: '"궁서", 궁서체, serif'}).setColor('#000000').setOrigin(0.5,0.5);
WordSpace.totalWeight += this.wordWeight;
WordSpace.setGameOverTimer();
console.log("Total weight : " + WordSpace.totalWeight);
} }
destroy() destroy()
......
var WordSpace = WordSpace || {}; var WordSpace = WordSpace || {};
WordSpace.gameSceneForTest = null; // for test
WordSpace.isImageLoaded = false; WordSpace.isImageLoaded = false;
WordSpace.nextWordCode = 0; WordSpace.nextWordCode = 0;
...@@ -58,7 +60,7 @@ WordSpace.attackGauge = ...@@ -58,7 +60,7 @@ WordSpace.attackGauge =
this.text = scene.add.text(100,100,'게이지: ' + this.value.toFixed(1)).setColor('#ffffff').setDepth(10); this.text = scene.add.text(100,100,'게이지: ' + this.value.toFixed(1)).setColor('#ffffff').setDepth(10);
}, },
pauseCycle: function(bool) {this.currentCycle.paused = bool;} pauseCycle: function(bool) {this.currentCycle.paused = bool;},
// showValue: 아래쪽에 바의 길이로 게이지 표시, 색으로 게이지의 강도 표현 // showValue: 아래쪽에 바의 길이로 게이지 표시, 색으로 게이지의 강도 표현
} }
...@@ -72,7 +74,7 @@ WordSpace.wordCycle = ...@@ -72,7 +74,7 @@ WordSpace.wordCycle =
delay: _delay, delay: _delay,
callback: function() callback: function()
{ {
WordSpace.generateWord(this) WordSpace.generateWord(this, '통관');
}, },
callbackScope: scene, callbackScope: scene,
loop: true loop: true
...@@ -94,11 +96,12 @@ WordSpace.loadImage = function(scene) ...@@ -94,11 +96,12 @@ WordSpace.loadImage = function(scene)
{ {
scene.load.image('wordBackground', 'assets/wordBackground.png'); scene.load.image('wordBackground', 'assets/wordBackground.png');
} }
WordSpace.gameSceneForTest = scene; // for test
} }
WordSpace.generateWord = function(scene) WordSpace.generateWord = function(scene, wordText)
{ {
word = new WordObject("솽젠커"); word = new WordObject(wordText);
word.instantiate(scene); word.instantiate(scene);
WordSpace.wordGroup.push(word); WordSpace.wordGroup.push(word);
WordSpace.wordForcedGroup.push(word); WordSpace.wordForcedGroup.push(word);
...@@ -130,11 +133,11 @@ WordSpace.setGameOverTimer = function() ...@@ -130,11 +133,11 @@ WordSpace.setGameOverTimer = function()
} }
} }
WordSpace.findWord = function(word) WordSpace.findWord = function(wordText)
{ {
var found = WordSpace.wordGroup.filter(function(element) var found = WordSpace.wordGroup.filter(function(element)
{ {
return Input.isEqual(word, element.wordText); return Input.isEqual(wordText, element.wordText);
}); });
if (found.length != 0) if (found.length != 0)
{ {
...@@ -153,8 +156,33 @@ WordSpace.findWord = function(word) ...@@ -153,8 +156,33 @@ WordSpace.findWord = function(word)
} }
weightest.destroy(); weightest.destroy();
} }
else if (word === '공격') // 공격모드 진입. else if (wordText === '공격' && WordSpace.attackGauge.value > 3) // 공격모드 진입.
{ {
console.log('attack mode'); console.log('attack mode');
// 이부분에서 최대 단어수 결정
Input.attackMode = true;
WordSpace.attackGauge.pauseCycle(true);
}
else
{
// 오타 체크
}
}
WordSpace.attack = function(wordText)
{
if (wordText != '')
{
console.log('attack ' + wordText);
WordSpace.generateWord(WordSpace.gameSceneForTest, wordText); // for test
// 이부분에서 게이지에 따라 급수 결정
// 이부분은 서버 잘써야함
WordSpace.attackGauge.resetValue();
}
else
{
WordSpace.attackGauge.cutValue(0.3);
} }
Input.attackMode = false;
WordSpace.attackGauge.pauseCycle(false);
} }
\ 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