Commit 98b78aa5 authored by 18손재민's avatar 18손재민

게임오버 타이머 리셋 wip

parent 19715838
......@@ -293,6 +293,7 @@ Input.inputField =
{
if (Input.attackMode) WordSpace.attack(Input.convInput);
else WordSpace.findWord(Input.convInput);
WordSpace.resetGameOverTimer();
Input.reset();
});
// upside 10 keys
......
......@@ -17,7 +17,6 @@ class WordObject
})(this.wordGrade);
//console.log("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
this.wordSpeed = 1;
//alert("wordTyping : " + this.wordTyping + '\n' + "wordGrade : " + this.wordGrade + '\n' + "wordWeight : " + this.wordWeight + '\n');
}
instantiate(scene)
......
......@@ -6,8 +6,8 @@ WordSpace.isImageLoaded = false;
WordSpace.nextWordCode = 0;
WordSpace.totalWeight = 0; //현재 단어 무게 총합
WordSpace.brainCapacity = 200; //수용 가능한 단어 무게 최대치
WordSpace.defeatTime = 3000;
WordSpace.brainCapacity = 20; //수용 가능한 단어 무게 최대치
WordSpace.defeatTime = 5000;
WordSpace.gameOverTimer = null; //게임 오버 판정 타이머
WordSpace.isTimerOn = false;
......@@ -125,7 +125,7 @@ WordSpace.generateWord = function(scene, wordText)
function gameOver()
{
this.wordCycle.currentCycle.paused = true;
WordSpace.wordCycle.currentCycle.remove();
//To Do
console.log('defeat');
}
......@@ -136,8 +136,30 @@ WordSpace.setGameOverTimer = function()
//만약 현재 단어 무게 총합이 뇌 용량보다 크다면 타이머를 시작함
if(this.brainCapacity < this.totalWeight && !this.isTimerOn)
{
this.gameOverTimer = setTimeout(gameOver.bind(this), this.defeatTime);
isTimerOn = true;
var timer =
{
delay: this.defeatTime,
callback: function()
{
isTimerOn = true;
gameOver();
},
callbackScope: WordSpace.gameSceneForTest,
loop: false
}
this.gameOverTimer = WordSpace.gameSceneForTest.time.addEvent(timer);
//this.gameOverTimer = setTimeout(gameOver.bind(this), this.defeatTime);
//isTimerOn = true;
}
}
WordSpace.resetGameOverTimer = function()
{
if(this.brainCapacity >= this.totalWeight && this.isTimerOn)
{
console.log('d');
this.gameOverTimer.remove();
}
}
......
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