Fix: add more speech text, timer text bug
This commit is contained in:
@@ -286,9 +286,11 @@ var Game = {
|
|||||||
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
|
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
|
||||||
this.badMeatCount++;
|
this.badMeatCount++;
|
||||||
|
|
||||||
if(meat.getTotalCookingTime() == 0)
|
if(meat.getTotalCookingTime() == 0) {
|
||||||
this.god.animateAngryWithRare();
|
this.god.animateAngryWithRare();
|
||||||
else
|
|
||||||
|
return; // god doesn't eat rare meat
|
||||||
|
} else
|
||||||
this.god.animateSmile();
|
this.god.animateSmile();
|
||||||
|
|
||||||
if(meat.getTotalCookingTime() > 0) {
|
if(meat.getTotalCookingTime() > 0) {
|
||||||
|
|||||||
@@ -73,8 +73,61 @@ God.prototype.isOver = function(x, y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
God.prototype.getRandomSpeechText = function(grade) {
|
||||||
|
var donenessNoneTextArray = [
|
||||||
|
"날고기\n안먹어!!!",
|
||||||
|
"구워서\n줘야지!!!"
|
||||||
|
];
|
||||||
|
|
||||||
|
var donenessRareTextArray = [
|
||||||
|
"덜 익었는데???",
|
||||||
|
"좀 질기네.",
|
||||||
|
"좀 더 익혀줘!"
|
||||||
|
];
|
||||||
|
|
||||||
|
var donenessWelldoneTextArray = [
|
||||||
|
"맛있어!\n^o^",
|
||||||
|
"이 맛이지!\n^o^",
|
||||||
|
"고마워!\n^o^",
|
||||||
|
"꿀맛이야!\n^o^",
|
||||||
|
];
|
||||||
|
|
||||||
|
var donenessBurnBlackTextArray = [
|
||||||
|
"탄고기\n안먹어!!!",
|
||||||
|
"탄고기는\n쓰레기통으로!",
|
||||||
|
"태우면\n어떡해!!!"
|
||||||
|
];
|
||||||
|
|
||||||
|
var speechText = "";
|
||||||
|
var randomIndex = 0;
|
||||||
|
switch(grade) {
|
||||||
|
case MeatBase.DONENESS_NONE:
|
||||||
|
randomIndex = Math.floor(Math.random() * donenessNoneTextArray.length);
|
||||||
|
speechText = donenessNoneTextArray[randomIndex];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MeatBase.DONENESS_RARE:
|
||||||
|
randomIndex = Math.floor(Math.random() * donenessRareTextArray.length);
|
||||||
|
speechText = donenessRareTextArray[randomIndex];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MeatBase.DONENESS_WELLDONE:
|
||||||
|
randomIndex = Math.floor(Math.random() * donenessWelldoneTextArray.length);
|
||||||
|
speechText = donenessWelldoneTextArray[randomIndex];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MeatBase.DONENESS_BURN_BLACK:
|
||||||
|
randomIndex = Math.floor(Math.random() * donenessBurnBlackTextArray.length);
|
||||||
|
speechText = donenessBurnBlackTextArray[randomIndex];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return speechText;
|
||||||
|
}
|
||||||
|
|
||||||
God.prototype.animateHappy = function() {
|
God.prototype.animateHappy = function() {
|
||||||
this.speechBubble.animateRoundSpeech(God.SPEECH_X, God.SPEECH_Y, "맛있어. ^o^");
|
var speechText = this.getRandomSpeechText(MeatBase.DONENESS_WELLDONE);
|
||||||
|
this.speechBubble.animateRoundSpeech(God.SPEECH_X, God.SPEECH_Y, speechText);
|
||||||
this.particleBurst(God.REACTION_WELLDONE);
|
this.particleBurst(God.REACTION_WELLDONE);
|
||||||
|
|
||||||
this.loadTexture('god_happy');
|
this.loadTexture('god_happy');
|
||||||
@@ -85,7 +138,8 @@ God.prototype.animateHappy = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.animateSmile = function() {
|
God.prototype.animateSmile = function() {
|
||||||
this.speechBubble.animateRectSpeech(God.SPEECH_X, God.SPEECH_Y, "좀 질기네. -_-");
|
var speechText = this.getRandomSpeechText(MeatBase.DONENESS_RARE);
|
||||||
|
this.speechBubble.animateRectSpeech(God.SPEECH_X, God.SPEECH_Y, speechText);
|
||||||
this.particleBurst(God.REACTION_MEDIUM);
|
this.particleBurst(God.REACTION_MEDIUM);
|
||||||
|
|
||||||
this.loadTexture('god_smile');
|
this.loadTexture('god_smile');
|
||||||
@@ -96,7 +150,8 @@ God.prototype.animateSmile = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.animateAngryWithRare = function() {
|
God.prototype.animateAngryWithRare = function() {
|
||||||
this.speechBubble.animateStarSpeech(God.SPEECH_X, God.SPEECH_Y, "날고기 싫어!!!");
|
var speechText = this.getRandomSpeechText(MeatBase.DONENESS_NONE);
|
||||||
|
this.speechBubble.animateStarSpeech(God.SPEECH_X, God.SPEECH_Y, speechText);
|
||||||
this.particleBurst(God.REACTION_RARE);
|
this.particleBurst(God.REACTION_RARE);
|
||||||
|
|
||||||
this.loadTexture('god_angry');
|
this.loadTexture('god_angry');
|
||||||
@@ -107,7 +162,8 @@ God.prototype.animateAngryWithRare = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.animateAngryWithBurnBlack = function() {
|
God.prototype.animateAngryWithBurnBlack = function() {
|
||||||
this.speechBubble.animateDoubleStarSpeech(God.SPEECH_X, God.SPEECH_Y, "탄고기\n안먹어!!!");
|
var speechText = this.getRandomSpeechText(MeatBase.DONENESS_BURN_BLACK);
|
||||||
|
this.speechBubble.animateDoubleStarSpeech(God.SPEECH_X, God.SPEECH_Y, speechText);
|
||||||
this.particleBurst(God.REACTION_BURN_BLACK);
|
this.particleBurst(God.REACTION_BURN_BLACK);
|
||||||
|
|
||||||
this.loadTexture('god_angry');
|
this.loadTexture('god_angry');
|
||||||
@@ -132,7 +188,7 @@ God.prototype.particleBurst = function(reaction) {
|
|||||||
|
|
||||||
switch(reaction) {
|
switch(reaction) {
|
||||||
case God.REACTION_WELLDONE:
|
case God.REACTION_WELLDONE:
|
||||||
this.fullHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 10, true);
|
this.fullHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS * 3 / 4, 100, 10, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case God.REACTION_MEDIUM:
|
case God.REACTION_MEDIUM:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ SpeechBubble.prototype = Object.create(Phaser.Sprite.prototype);
|
|||||||
SpeechBubble.prototype.constructor = SpeechBubble;
|
SpeechBubble.prototype.constructor = SpeechBubble;
|
||||||
|
|
||||||
function SpeechBubble() {
|
function SpeechBubble() {
|
||||||
var textStyle = { font: "normal 24px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" };
|
var textStyle = { font: "normal 24px Arial", fill: "#fff", align: "center" };
|
||||||
|
|
||||||
Phaser.Sprite.call(this, game, SpeechBubble.POSITION_X, SpeechBubble.POSITION_Y, '');
|
Phaser.Sprite.call(this, game, SpeechBubble.POSITION_X, SpeechBubble.POSITION_Y, '');
|
||||||
this.anchor.set(0.5);
|
this.anchor.set(0.5);
|
||||||
|
|||||||
@@ -71,11 +71,8 @@ TimerStage.prototype.initialize = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TimerStage.prototype.updateTimer = function() {
|
TimerStage.prototype.updateTimer = function() {
|
||||||
// console.log(game.time.totalElapsedSeconds());
|
|
||||||
// console.log(this.mainTimer.ms);
|
|
||||||
var timeLeft = this.timeLimitMS - this.mainTimer.ms;
|
var timeLeft = this.timeLimitMS - this.mainTimer.ms;
|
||||||
this.mainTimerText.setMSTimeText(timeLeft);
|
this.mainTimerText.setMSTimeText(timeLeft);
|
||||||
// this.mainTimerText.setMSTimeText(this.mainTimer.ms);
|
|
||||||
|
|
||||||
if(timeLeft < 0) {
|
if(timeLeft < 0) {
|
||||||
console.log("Game Over");
|
console.log("Game Over");
|
||||||
@@ -104,9 +101,7 @@ TimerStage.prototype.buttonClicked = function() {
|
|||||||
this.decideGrade(this.timeLimitMS - this.mainTimer.ms);
|
this.decideGrade(this.timeLimitMS - this.mainTimer.ms);
|
||||||
|
|
||||||
this.mainTimer.stop(false);
|
this.mainTimer.stop(false);
|
||||||
// this.updateTimer();
|
|
||||||
|
|
||||||
// this.mainTimerText.setMSTimeText(this.timeLimitMS);
|
|
||||||
this.isTimerStarted = false;
|
this.isTimerStarted = false;
|
||||||
this.isTimerStoped = true;
|
this.isTimerStoped = true;
|
||||||
this.timerButton.text.text = "리셋";
|
this.timerButton.text.text = "리셋";
|
||||||
@@ -154,7 +149,6 @@ TimerStage.prototype.gradeGreat = function(timeLeft) {
|
|||||||
"Brown"
|
"Brown"
|
||||||
);
|
);
|
||||||
|
|
||||||
// this.recordArray.push( { timeLeft, score } );
|
|
||||||
var record = {};
|
var record = {};
|
||||||
record.timeLeft = timeLeft;
|
record.timeLeft = timeLeft;
|
||||||
record.score = score;
|
record.score = score;
|
||||||
@@ -174,7 +168,6 @@ TimerStage.prototype.gradeGood = function(timeLeft) {
|
|||||||
"Chocolate"
|
"Chocolate"
|
||||||
);
|
);
|
||||||
|
|
||||||
// this.recordArray.push( { timeLeft, score } );
|
|
||||||
var record = {};
|
var record = {};
|
||||||
record.timeLeft = timeLeft;
|
record.timeLeft = timeLeft;
|
||||||
record.score = score;
|
record.score = score;
|
||||||
@@ -194,7 +187,6 @@ TimerStage.prototype.gradeSoSo = function(timeLeft) {
|
|||||||
"GoldenRod"
|
"GoldenRod"
|
||||||
);
|
);
|
||||||
|
|
||||||
// this.recordArray.push( { timeLeft, score } );
|
|
||||||
var record = {};
|
var record = {};
|
||||||
record.timeLeft = timeLeft;
|
record.timeLeft = timeLeft;
|
||||||
record.score = score;
|
record.score = score;
|
||||||
@@ -214,7 +206,6 @@ TimerStage.prototype.gradeBad = function(timeLeft) {
|
|||||||
"LightGoldenRodYellow"
|
"LightGoldenRodYellow"
|
||||||
);
|
);
|
||||||
|
|
||||||
// this.recordArray.push( { timeLeft, score } );
|
|
||||||
var record = {};
|
var record = {};
|
||||||
record.timeLeft = timeLeft;
|
record.timeLeft = timeLeft;
|
||||||
record.score = score;
|
record.score = score;
|
||||||
@@ -225,8 +216,6 @@ TimerStage.prototype.gradeBad = function(timeLeft) {
|
|||||||
|
|
||||||
|
|
||||||
TimerStage.prototype.updateTimeScoreRecordArray = function() {
|
TimerStage.prototype.updateTimeScoreRecordArray = function() {
|
||||||
// console.log(this.recordArray);
|
|
||||||
|
|
||||||
for(var i = 0; i < TimerStage.RECORD_COUNT; i++) {
|
for(var i = 0; i < TimerStage.RECORD_COUNT; i++) {
|
||||||
var timeScoreRecordIndex = i;
|
var timeScoreRecordIndex = i;
|
||||||
var recordIndex = this.recordArray.length - 1 - i;
|
var recordIndex = this.recordArray.length - 1 - i;
|
||||||
@@ -234,7 +223,6 @@ TimerStage.prototype.updateTimeScoreRecordArray = function() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
var record = this.recordArray[recordIndex];
|
var record = this.recordArray[recordIndex];
|
||||||
// console.log(record);
|
|
||||||
this.timeScoreRecordArray[timeScoreRecordIndex].setContent(record.timeLeft, record.score);
|
this.timeScoreRecordArray[timeScoreRecordIndex].setContent(record.timeLeft, record.score);
|
||||||
if(record.timeLeft < TimerStage.GRADE_GREAT_MS)
|
if(record.timeLeft < TimerStage.GRADE_GREAT_MS)
|
||||||
this.timeScoreRecordArray[timeScoreRecordIndex].setTextColorString("Brown");
|
this.timeScoreRecordArray[timeScoreRecordIndex].setTextColorString("Brown");
|
||||||
|
|||||||
@@ -30,17 +30,15 @@ TimerText.prototype.setTextColorString = function(colorString) {
|
|||||||
this.digitText.style.fill = colorString;
|
this.digitText.style.fill = colorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
TimerText.prototype.setMSTimeText = function(ms) {
|
TimerText.prototype.setMSTimeText = function(timeLeft) {
|
||||||
var sec = Math.floor(ms / 1000);
|
var sec = Math.floor(timeLeft / 1000);
|
||||||
var sec2Digit = ("00" + sec).slice(-2);
|
var sec2Digit = ("00" + sec).slice(-2);
|
||||||
|
|
||||||
var millisec = ms % 1000;
|
var millisec = timeLeft % 1000;
|
||||||
var millisec2Digit = "" + millisec;
|
var millisec2Digit = "" + millisec;
|
||||||
if(millisec < 10)
|
if(millisec < 10)
|
||||||
millisec2Digit = ("000" + millisec).substring(0, 2);
|
millisec2Digit = "00";
|
||||||
else if(millisec < 100)
|
else if(millisec < 100)
|
||||||
millisec2Digit = ("00" + millisec).substring(0, 2);
|
|
||||||
else if(millisec < 10)
|
|
||||||
millisec2Digit = ("0" + millisec).substring(0, 2);
|
millisec2Digit = ("0" + millisec).substring(0, 2);
|
||||||
else
|
else
|
||||||
millisec2Digit = ("" + millisec).substring(0, 2);
|
millisec2Digit = ("" + millisec).substring(0, 2);
|
||||||
|
|||||||
@@ -67,9 +67,9 @@
|
|||||||
<!-- Card matching : source files -->
|
<!-- Card matching : source files -->
|
||||||
<script src="../../game/mouse/just_on_time/god.js"></script>
|
<script src="../../game/mouse/just_on_time/god.js"></script>
|
||||||
|
|
||||||
<script src="../../game/mouse/just_on_time/timer_text.js"></script>
|
<script src="../../game/mouse/just_on_time/timer_text.js?update=191221"></script>
|
||||||
<script src="../../game/mouse/just_on_time/time_score_record.js"></script>
|
<script src="../../game/mouse/just_on_time/time_score_record.js"></script>
|
||||||
<script src="../../game/mouse/just_on_time/timer_stage.js"></script>
|
<script src="../../game/mouse/just_on_time/timer_stage.js?update=191221"></script>
|
||||||
|
|
||||||
<script src="../../game/mouse/just_on_time/just_on_time.js"></script>
|
<script src="../../game/mouse/just_on_time/just_on_time.js"></script>
|
||||||
<script src="../../game/mouse/just_on_time/main.js"></script>
|
<script src="../../game/mouse/just_on_time/main.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user