Fix: add more speech text, timer text bug

This commit is contained in:
2019-12-13 08:54:46 +09:00
parent db05c2f2d7
commit a6c4629edf
6 changed files with 72 additions and 28 deletions
+4 -2
View File
@@ -286,9 +286,11 @@ var Game = {
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
this.badMeatCount++;
if(meat.getTotalCookingTime() == 0)
if(meat.getTotalCookingTime() == 0) {
this.god.animateAngryWithRare();
else
return; // god doesn't eat rare meat
} else
this.god.animateSmile();
if(meat.getTotalCookingTime() > 0) {
+61 -5
View File
@@ -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() {
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.loadTexture('god_happy');
@@ -85,7 +138,8 @@ God.prototype.animateHappy = 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.loadTexture('god_smile');
@@ -96,7 +150,8 @@ God.prototype.animateSmile = 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.loadTexture('god_angry');
@@ -107,7 +162,8 @@ God.prototype.animateAngryWithRare = 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.loadTexture('god_angry');
@@ -132,7 +188,7 @@ God.prototype.particleBurst = function(reaction) {
switch(reaction) {
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;
case God.REACTION_MEDIUM:
+1 -1
View File
@@ -2,7 +2,7 @@ SpeechBubble.prototype = Object.create(Phaser.Sprite.prototype);
SpeechBubble.prototype.constructor = 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, '');
this.anchor.set(0.5);
@@ -71,11 +71,8 @@ TimerStage.prototype.initialize = function() {
}
TimerStage.prototype.updateTimer = function() {
// console.log(game.time.totalElapsedSeconds());
// console.log(this.mainTimer.ms);
var timeLeft = this.timeLimitMS - this.mainTimer.ms;
this.mainTimerText.setMSTimeText(timeLeft);
// this.mainTimerText.setMSTimeText(this.mainTimer.ms);
if(timeLeft < 0) {
console.log("Game Over");
@@ -104,9 +101,7 @@ TimerStage.prototype.buttonClicked = function() {
this.decideGrade(this.timeLimitMS - this.mainTimer.ms);
this.mainTimer.stop(false);
// this.updateTimer();
// this.mainTimerText.setMSTimeText(this.timeLimitMS);
this.isTimerStarted = false;
this.isTimerStoped = true;
this.timerButton.text.text = "리셋";
@@ -154,7 +149,6 @@ TimerStage.prototype.gradeGreat = function(timeLeft) {
"Brown"
);
// this.recordArray.push( { timeLeft, score } );
var record = {};
record.timeLeft = timeLeft;
record.score = score;
@@ -174,7 +168,6 @@ TimerStage.prototype.gradeGood = function(timeLeft) {
"Chocolate"
);
// this.recordArray.push( { timeLeft, score } );
var record = {};
record.timeLeft = timeLeft;
record.score = score;
@@ -194,7 +187,6 @@ TimerStage.prototype.gradeSoSo = function(timeLeft) {
"GoldenRod"
);
// this.recordArray.push( { timeLeft, score } );
var record = {};
record.timeLeft = timeLeft;
record.score = score;
@@ -214,7 +206,6 @@ TimerStage.prototype.gradeBad = function(timeLeft) {
"LightGoldenRodYellow"
);
// this.recordArray.push( { timeLeft, score } );
var record = {};
record.timeLeft = timeLeft;
record.score = score;
@@ -225,8 +216,6 @@ TimerStage.prototype.gradeBad = function(timeLeft) {
TimerStage.prototype.updateTimeScoreRecordArray = function() {
// console.log(this.recordArray);
for(var i = 0; i < TimerStage.RECORD_COUNT; i++) {
var timeScoreRecordIndex = i;
var recordIndex = this.recordArray.length - 1 - i;
@@ -234,7 +223,6 @@ TimerStage.prototype.updateTimeScoreRecordArray = function() {
break;
var record = this.recordArray[recordIndex];
// console.log(record);
this.timeScoreRecordArray[timeScoreRecordIndex].setContent(record.timeLeft, record.score);
if(record.timeLeft < TimerStage.GRADE_GREAT_MS)
this.timeScoreRecordArray[timeScoreRecordIndex].setTextColorString("Brown");
+4 -6
View File
@@ -30,17 +30,15 @@ TimerText.prototype.setTextColorString = function(colorString) {
this.digitText.style.fill = colorString;
}
TimerText.prototype.setMSTimeText = function(ms) {
var sec = Math.floor(ms / 1000);
TimerText.prototype.setMSTimeText = function(timeLeft) {
var sec = Math.floor(timeLeft / 1000);
var sec2Digit = ("00" + sec).slice(-2);
var millisec = ms % 1000;
var millisec = timeLeft % 1000;
var millisec2Digit = "" + millisec;
if(millisec < 10)
millisec2Digit = ("000" + millisec).substring(0, 2);
millisec2Digit = "00";
else if(millisec < 100)
millisec2Digit = ("00" + millisec).substring(0, 2);
else if(millisec < 10)
millisec2Digit = ("0" + millisec).substring(0, 2);
else
millisec2Digit = ("" + millisec).substring(0, 2);
+2 -2
View File
@@ -67,9 +67,9 @@
<!-- Card matching : source files -->
<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/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/main.js"></script>