diff --git a/src/game/lib/stage_timer.js b/src/game/lib/stage_timer.js index 635c84c..728508a 100644 --- a/src/game/lib/stage_timer.js +++ b/src/game/lib/stage_timer.js @@ -67,6 +67,11 @@ StageTimer.prototype.removeTimer = function() { this.timerEvent = null; } +StageTimer.prototype.add = function(timeSec) { + this.timeLeft += timeSec; + this.printTime(); +} + StageTimer.FONT_HEIGHT_PX = 70; diff --git a/src/game/mouse/grilled_meat/game.js b/src/game/mouse/grilled_meat/game.js index e30c8c4..3dd3895 100644 --- a/src/game/mouse/grilled_meat/game.js +++ b/src/game/mouse/grilled_meat/game.js @@ -46,7 +46,7 @@ var Game = { Game.GAME_TIME_SEC, (function() { this.setClickEnable(false); - + this.showStageNotice("시간 종료"); this.gameOver(); }).bind(this) ); @@ -60,7 +60,36 @@ var Game = { this.plusScoreGroup = game.add.group(); + var textStyle = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" }; + this.stageNoticeText = game.add.text(0, 0, "", textStyle); + this.stageNoticeText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); + this.stageNoticeText.setTextBounds(0, 60, 1000, 80); + var table = game.add.tileSprite(0, 340, GAME_SCREEN_SIZE.x, 660, 'wooden_table'); + this.meatPlate = game.add.image(220, Game.MEAT_PLATE_POSITION_Y, 'plate'); + this.meatPlate.anchor.set(0.5); + this.meatPlate.smoothed = false; + + this.heatPlate = game.add.image(game.world.centerX, Game.HEAT_PLATE_POSITION_Y, 'heat_plate'); + this.heatPlate.anchor.set(0.5); + this.heatPlate.smoothed = false; + this.heatPlate.scale.set(1); + + this.god = new God(game.world.width - 120, Game.GOD_POSITION_Y + 100, this); + + // meat + this.meatGroup = game.add.group(); + for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) { + var meat = new Meat(this); + meat.name = "meat" + i; + meat.setActive(false, -100, -100, ""); + this.meatGroup.add(meat); + } + + // speech bubble + this.speechBubble = new SpeechBubble(game.world.centerX + 100, game.world.centerY - 160); + this.speechBubble.hideSpeechBubble(); + // bottom ui @@ -75,6 +104,29 @@ var Game = { }, initVariables: function() { + this.playingStageNo; + this.activatedMeatCount; + this.clearedMeatCount; + + // this.score; + // this.scoreText; + // this.highscore; + // this.highscoreText; + this.plusScoreTextGroup; + this.stageNoticeText; + + this.popup; + this.popupTween = null; + this.startButton; + + // this.leftTimeText; + // this.leftTimeSec; + + this.timeEvent; + this.gameTimeEvents = []; + + this.meatCount; + }, @@ -116,9 +168,35 @@ var Game = { */ startGame: function() { + this.playingStageNo = 1; + // this.leftTimeSec = 0; // INIT_LEFT_TIME_MIN * 60; + + // this.score = 0; + // this.updateScore(); + + this.startStage(); }, startStage: function() { + var bonusTime = this.getBonusTime(); + if(this.playingStageNo == 1) + this.showStageNotice(this.playingStageNo + "단계 시작 (제한 시간 : " + bonusTime + "초)"); + else if(bonusTime == 0) + this.showStageNotice(this.playingStageNo + "단계 시작"); + else + this.showStageNotice(this.playingStageNo + "단계 시작 (보너스 +" + bonusTime + "초)"); + + // this.leftTimeSec += bonusTime; + this.stageTimer.start(); + // this.stageTimer.add(bonusTime); + // this.updateLeftTime(); + + // if(this.playingStageNo == 1) + // this.timeEvent = game.time.events.loop(1000, this.updateLeftTime, this); + + this.activatedMeatCount = this.getStageMeatCount(); + this.clearedMeatCount = 0; + this.serveMeats(); }, startNextStage: function() { @@ -129,6 +207,151 @@ var Game = { this.isEnableClick = value; }, + getStageMeatCount: function() { + this.activatedMeatCount = this.playingStageNo + 2; + return this.activatedMeatCount; + }, + + serveMeats: function() { + for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) { + var meat = this.meatGroup.children[i]; + meat.setActive(false, -100, -100, ""); + } + + for(var i = 0; i < this.activatedMeatCount; i++) { + var meat = this.meatGroup.children[i]; + var randX = this.meatPlate.x - game.rnd.integerInRange(-100, 100); + var randY = this.meatPlate.y - game.rnd.integerInRange(-30, 30); + meat.setActive(true, randX, randY, ""); + } + }, + + getBonusTime: function() { + if(this.playingStageNo == 1) + return Game.INIT_LEFT_TIME_MIN * 60; + + var bonusTime = 0; + if(this.playingStageNo < 10) + bonusTime = Math.floor(10 / this.playingStageNo) * (Game.INIT_LEFT_TIME_MIN * 2); + + return bonusTime; + }, + + // updateLeftTime: function() { + // this.leftTimeSec--; + // this.leftTimeText.text = this.leftTimeSec; + // if(this.leftTimeSec == 0) { + // this.showStageNotice("시간 종료"); + // this.gameOver(); + // } + // }, + + showStageNotice: function(text) { + this.stageNoticeText.alpha = 0; + this.stageNoticeText.text = text; + this.animateTextAlpha(this.stageNoticeText, 1, 0, 1000, Phaser.Easing.Linear.None); + }, + + + + // addScore: function() { + // // this.score += 10 * this.playingStageNo; + // this.scoreManager.addScore(10 * this.playingStageNo); + // }, + + // updateScore: function() { + // this.scoreText.text = this.score; + // }, + + // updateHighscore: function() { + // if(this.score > this.highscore) { + // highscore = score; + // highscoreText.text = highscore; + + // showStageNotice("!!! 최고 점수 갱신 !!!"); + // } + // }, + + isOverHeatPlate: function(x, y, width, height) { + var plateHalfWidth = (this.heatPlate.width - Game.HEAT_PLATE_HANDLE_WIDTH) / 2; + var plateHalfHeight = this.heatPlate.height / 2; + + if(x < this.heatPlate.x - plateHalfWidth) { + return false; + } else if(this.heatPlate.x + plateHalfWidth < x) { + return false; + } else if(y < this.heatPlate.y - plateHalfHeight + Game.HEAT_PLATE_START_OFFSET_Y) { + return false; + } else if(this.heatPlate.y + plateHalfHeight + Game.HEAT_PLATE_START_OFFSET_Y - Game.HEAT_PLATE_HEIGHT< y) { + return false; + } + + return true; + }, + + isOverGod: function(x, y, width, height) { + // console.log("isOverGod : " + x + ", " + y + ", " + width + ", " + height); + + var godHalfWidth = (this.god.width - Game.GOD_OUT_OF_FACE_WIDTH) / 2; + var godHalfHeight = this.god.height / 2; + if(x < this.god.x - godHalfWidth) { + return false; + } else if(this.god.x + godHalfWidth < x) { + return false; + } else if(y < this.god.y - this.god.height + Game.GOD_OUT_OF_FACE_HEIGHT) { + return false; + } else if(this.god.y - Game.GOD_OUT_OF_FACE_HEIGHT < y) { + return false; + } + + return true; + }, + + godEatMeat: function(meat) { + // console.log("isOverGod : " + x + ", " + y + ", " + width + ", " + height); + + // console.log("god eat : " + meat); + // console.log("meat grade : " + meat.getMeatGrade()); + + if(meat.getMeatGrade() == Meat.DONENESS_WELLDONE) { + this.god.animateHappy(Meat.DONENESS_WELLDONE); // "맛있어♥♡♥"); + + // this.addScore(); + // this.updateScore(); + this.scoreManager.plusScore(10 * this.playingStageNo); + + var tempPlusScore = new PlusScore(this.god.x, this.god.y - 180, 10 * this.playingStageNo); + this.plusScoreGroup.add(tempPlusScore); + } else { + if(meat.getMeatGrade() == Meat.DONENESS_RARE) { + this.god.animateAngry(Meat.DONENESS_RARE); // "날고기 싫어!!!"); + } else { // Meat.DONENESS_BURN_BLACK + this.god.animateAngry(Meat.DONENESS_BURN_BLACK); // "탄 고기 안먹어!!!"); + } + } + + meat.setActive(false, -100, -100, ''); + this.clearedMeatCount++; + if(this.clearedMeatCount == this.activatedMeatCount) { + this.clearStage(); + } + }, + + clearStage: function() { + this.showStageNotice(this.playingStageNo + "단계 완료"); + this.playingStageNo++; + + var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startStage, this); + this.gameTimeEvents[this.gameTimeEvents.length + 1] = startStageTimeEvent; + }, + + + + animateTextAlpha: function(targetText, startAlpha, endAlpha, msTime, effectType) { + targetText.alpha = startAlpha; + game.add.tween(targetText).to({alpha: endAlpha}, msTime, effectType, true); + }, + gameOver: function() { @@ -142,4 +365,19 @@ var Game = { Game.GAME_TIME_SEC = 60; -Game.NEXT_STAGE_DELAY_MS = 500; \ No newline at end of file +Game.NEXT_STAGE_DELAY_MS = 500; + +Game.INIT_LEFT_TIME_MIN = 2; + +Game.MAX_MEAT_COUNT = 20; + +Game.HEAT_PLATE_HANDLE_WIDTH = 440; +Game.HEAT_PLATE_START_OFFSET_Y = 80; +Game.HEAT_PLATE_HEIGHT = 220; + +Game.GOD_OUT_OF_FACE_WIDTH = 30; +Game.GOD_OUT_OF_FACE_HEIGHT = 30; + +Game.MEAT_PLATE_POSITION_Y = 360; +Game.GOD_POSITION_Y = 240; +Game.HEAT_PLATE_POSITION_Y = GAME_SCREEN_SIZE.y / 2 + 220; diff --git a/src/game/mouse/grilled_meat/god.js b/src/game/mouse/grilled_meat/god.js index 59fd1bb..41fe21a 100644 --- a/src/game/mouse/grilled_meat/god.js +++ b/src/game/mouse/grilled_meat/god.js @@ -1,4 +1,5 @@ -God = function(game, x, y) { +God = function(x, y, mainGame) { + this.mainGame = mainGame; this.isActivated = true; Phaser.Sprite.call(this, game, x, y, 'god_angry'); @@ -39,9 +40,9 @@ God.prototype.setScale = function(size) { God.prototype.animateHappy = function(type) { this.loadTexture('god_happy'); - showSpeechBubble(type); + this.mainGame.speechBubble.showSpeechBubble(type); - var tween = game.add.tween(god.scale); + var tween = game.add.tween(this.scale); tween.to({x:0.7, y:0.7}, 500, Phaser.Easing.Quadratic.Out, true, 0); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0); @@ -51,9 +52,9 @@ God.prototype.animateHappy = function(type) { God.prototype.animateAngry = function(type) { this.loadTexture('god_angry'); - showSpeechBubble(type); + this.mainGame.speechBubble.showSpeechBubble(type); - var tween = game.add.tween(god.scale); + var tween = game.add.tween(this.scale); tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Bounce.Out, true, 0); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true); // tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0); diff --git a/src/game/mouse/grilled_meat/meat.js b/src/game/mouse/grilled_meat/meat.js index 0b88155..856cc70 100644 --- a/src/game/mouse/grilled_meat/meat.js +++ b/src/game/mouse/grilled_meat/meat.js @@ -9,20 +9,16 @@ var ANGLE_BACK = -30; var COOK_TIME_WELLDONE = 200; var COOK_TIME_BURN = 400; -var DONENESS_RARE = 0; -var DONENESS_WELLDONE = 1; -var DONENESS_BURN_BLACK = 2; -var DONENESS_NONE = 3; - -Meat = function(game) { +Meat = function(mainGame) { + this.mainGame = mainGame; this.cookingSide = MEAT_BACK; this.cookingTime = []; this.cookingGrade = []; this.cookingTime[MEAT_BACK] = 0; this.cookingTime[MEAT_FRONT] = 0; - this.cookingGrade[MEAT_BACK] = DONENESS_RARE; - this.cookingGrade[MEAT_FRONT] = DONENESS_RARE; + this.cookingGrade[MEAT_BACK] = Meat.DONENESS_RARE; + this.cookingGrade[MEAT_FRONT] = Meat.DONENESS_RARE; this.isActivated = true; @@ -32,7 +28,7 @@ Meat = function(game) { this.downPositionX; this.downPositionY; - Phaser.Sprite.call(this, game, meatPlate.x, meatPlate.y, 'meat1'); + Phaser.Sprite.call(this, game, this.mainGame.meatPlate.x, this.mainGame.meatPlate.y, 'meat1'); this.anchor.set(0.5); this.scale.set(0.5); this.smoothed = false; @@ -52,10 +48,10 @@ Meat.prototype.constructor = Meat; Meat.prototype.update = function() { var positionY = this.y; - if(positionY <= godPositionY) + if(positionY <= Game.GOD_POSITION_Y) this.scale.set(0.4); - else if(positionY > godPositionY && positionY < heatPlatePositionY) { - var scaleRate = (positionY - godPositionY) / (heatPlatePositionY - godPositionY); + else if(positionY > Game.GOD_POSITION_Y && positionY < Game.HEAT_PLATE_POSITION_Y) { + var scaleRate = (positionY - Game.GOD_POSITION_Y) / (Game.HEAT_PLATE_POSITION_Y - Game.GOD_POSITION_Y); this.scale.set(0.4 + 0.3 * scaleRate); } else this.scale.set(0.4 + 0.3); @@ -76,7 +72,7 @@ Meat.prototype.onDown = function(sprite, pointer) { Meat.prototype.onUp = function(sprite, pointer) { // console.log("onUp : " + pointer.x + ", " + pointer.y); - + var upPositionX = Math.floor(sprite.x); var upPositionY = Math.floor(sprite.y); @@ -125,9 +121,7 @@ Meat.prototype.isInClickArea = function(downX, downY, upX, upY) { } Meat.prototype.onClickListener = function(pointer) { - console.log("onClick"); - - if(isOverHeatPlate(this.x, this.y, this.width, this.height) == true) { + if(this.mainGame.isOverHeatPlate(this.x, this.y, this.width, this.height) == true) { if(this.isFront() == true) this.flipToBack() else @@ -135,23 +129,23 @@ Meat.prototype.onClickListener = function(pointer) { // console.log("flip cooking side : " + this.cookingSide); - this.animateSmoke(DONENESS_NONE); + this.animateSmoke(Meat.DONENESS_NONE); } } Meat.prototype.onDragStopListener = function(pointer) { // console.log("onDragStop"); - if(isOverHeatPlate(this.x, this.y, this.width, this.height) == true) { + if(this.mainGame.isOverHeatPlate(this.x, this.y, this.width, this.height) == true) { // console.log("isOverHeatPlate : " + isOverHeatPlate(this.x, this.y, this.width, this.height)); this.startCook(); } else { this.stopCook(); } - if(isOverGod(this.x, this.y) == true) { + if(this.mainGame.isOverGod(this.x, this.y) == true) { // console.log("isOverGod : " + isOverGod(this.x, this.y)); - godEatMeat(this); + this.mainGame.godEatMeat(this); } } @@ -176,9 +170,9 @@ Meat.prototype.flipToFront = function() { this.angle = ANGLE_FRONT; // console.log("flipToFront"); // console.log("back : " + this.getMeatGradeBySide(MEAT_BACK) + ", front : " + this.getMeatGradeBySide(MEAT_FRONT)); - if(this.getMeatGradeBySide(MEAT_FRONT) == DONENESS_BURN_BLACK) { + if(this.getMeatGradeBySide(MEAT_FRONT) == Meat.DONENESS_BURN_BLACK) { this.loadTexture('meatBurn1'); - } else if(this.getMeatGradeBySide(MEAT_FRONT) == DONENESS_WELLDONE) { + } else if(this.getMeatGradeBySide(MEAT_FRONT) == Meat.DONENESS_WELLDONE) { this.loadTexture('meatWellDone1'); } else { this.loadTexture('meat1'); @@ -191,9 +185,9 @@ Meat.prototype.flipToBack = function() { this.angle = ANGLE_BACK; // console.log("flipToBack"); // console.log("back : " + this.getMeatGradeBySide(MEAT_BACK) + ", front : " + this.getMeatGradeBySide(MEAT_FRONT)); - if(this.getMeatGradeBySide(MEAT_BACK) == DONENESS_BURN_BLACK) { + if(this.getMeatGradeBySide(MEAT_BACK) == Meat.DONENESS_BURN_BLACK) { this.loadTexture('meatBurn1'); - } else if(this.getMeatGradeBySide(MEAT_BACK) == DONENESS_WELLDONE) { + } else if(this.getMeatGradeBySide(MEAT_BACK) == Meat.DONENESS_WELLDONE) { this.loadTexture('meatWellDone1'); } else { this.loadTexture('meat1'); @@ -215,7 +209,7 @@ Meat.prototype.startCook = function() { this.isOnHeatPlate = true; this.flipToFront(); - this.animateSmoke(DONENESS_NONE); + this.animateSmoke(Meat.DONENESS_NONE); } Meat.prototype.stopCook = function() { @@ -223,12 +217,12 @@ Meat.prototype.stopCook = function() { } Meat.prototype.getMeatGrade = function() { - if(this.cookingGrade[MEAT_FRONT] == DONENESS_WELLDONE && this.cookingGrade[MEAT_BACK] == DONENESS_WELLDONE) - return DONENESS_WELLDONE; - else if(this.cookingGrade[MEAT_FRONT] == DONENESS_BURN_BLACK || this.cookingGrade[MEAT_BACK] == DONENESS_BURN_BLACK) - return DONENESS_BURN_BLACK; + if(this.cookingGrade[MEAT_FRONT] == Meat.DONENESS_WELLDONE && this.cookingGrade[MEAT_BACK] == Meat.DONENESS_WELLDONE) + return Meat.DONENESS_WELLDONE; + else if(this.cookingGrade[MEAT_FRONT] == Meat.DONENESS_BURN_BLACK || this.cookingGrade[MEAT_BACK] == Meat.DONENESS_BURN_BLACK) + return Meat.DONENESS_BURN_BLACK; else - return DONENESS_RARE; + return Meat.DONENESS_RARE; } Meat.prototype.getMeatGradeBySide = function(cookingSide) { @@ -249,8 +243,8 @@ Meat.prototype.setActive = function(isActivated, x, y, meat_type) { this.cookingSide = MEAT_BACK; this.cookingTime[MEAT_BACK] = 0; this.cookingTime[MEAT_FRONT] = 0; - this.cookingGrade[MEAT_BACK] = DONENESS_RARE; - this.cookingGrade[MEAT_FRONT] = DONENESS_RARE; + this.cookingGrade[MEAT_BACK] = Meat.DONENESS_RARE; + this.cookingGrade[MEAT_FRONT] = Meat.DONENESS_RARE; this.x = x; this.y = y; @@ -264,26 +258,26 @@ Meat.prototype.cooking = function() { // console.log("back : " + this.cookingTime[MEAT_BACK] + ", front : " + this.cookingTime[MEAT_FRONT]); if(this.cookingTime[MEAT_BACK] > COOK_TIME_BURN) { - if(this.getMeatGradeBySide(MEAT_BACK) != DONENESS_BURN_BLACK) { - this.cookingGrade[MEAT_BACK] = DONENESS_BURN_BLACK; - this.animateSmoke(DONENESS_BURN_BLACK); + if(this.getMeatGradeBySide(MEAT_BACK) != Meat.DONENESS_BURN_BLACK) { + this.cookingGrade[MEAT_BACK] = Meat.DONENESS_BURN_BLACK; + this.animateSmoke(Meat.DONENESS_BURN_BLACK); } } else if(this.cookingTime[MEAT_BACK] > COOK_TIME_WELLDONE) { - if(this.getMeatGradeBySide(MEAT_BACK) != DONENESS_WELLDONE) { - this.cookingGrade[MEAT_BACK] = DONENESS_WELLDONE; - this.animateSmoke(DONENESS_WELLDONE); + if(this.getMeatGradeBySide(MEAT_BACK) != Meat.DONENESS_WELLDONE) { + this.cookingGrade[MEAT_BACK] = Meat.DONENESS_WELLDONE; + this.animateSmoke(Meat.DONENESS_WELLDONE); } } if(this.cookingTime[MEAT_FRONT] > COOK_TIME_BURN) { - if(this.getMeatGradeBySide(MEAT_FRONT) != DONENESS_BURN_BLACK) { - this.cookingGrade[MEAT_FRONT] = DONENESS_BURN_BLACK; - this.animateSmoke(DONENESS_BURN_BLACK); + if(this.getMeatGradeBySide(MEAT_FRONT) != Meat.DONENESS_BURN_BLACK) { + this.cookingGrade[MEAT_FRONT] = Meat.DONENESS_BURN_BLACK; + this.animateSmoke(Meat.DONENESS_BURN_BLACK); } } else if(this.cookingTime[MEAT_FRONT] > COOK_TIME_WELLDONE) { - if(this.getMeatGradeBySide(MEAT_FRONT) != DONENESS_WELLDONE) { - this.cookingGrade[MEAT_FRONT] = DONENESS_WELLDONE; - this.animateSmoke(DONENESS_WELLDONE); + if(this.getMeatGradeBySide(MEAT_FRONT) != Meat.DONENESS_WELLDONE) { + this.cookingGrade[MEAT_FRONT] = Meat.DONENESS_WELLDONE; + this.animateSmoke(Meat.DONENESS_WELLDONE); } } } @@ -291,10 +285,15 @@ Meat.prototype.cooking = function() { Meat.prototype.animateSmoke = function(type) { var smokeEffect = new Smoke(game, this.x + game.rnd.integerInRange(-50, 0), this.y); - if(type == DONENESS_WELLDONE) + if(type == Meat.DONENESS_WELLDONE) smokeEffect.tint = 0xff3333; - else if(type == DONENESS_BURN_BLACK) + else if(type == Meat.DONENESS_BURN_BLACK) smokeEffect.tint = 0x333333; } + +Meat.DONENESS_RARE = 0; +Meat.DONENESS_WELLDONE = 1; +Meat.DONENESS_BURN_BLACK = 2; +Meat.DONENESS_NONE = 3; \ No newline at end of file diff --git a/src/game/mouse/grilled_meat/speech_bubble.js b/src/game/mouse/grilled_meat/speech_bubble.js new file mode 100644 index 0000000..2be20e7 --- /dev/null +++ b/src/game/mouse/grilled_meat/speech_bubble.js @@ -0,0 +1,52 @@ +// SpeechBubble.prototype = Object.create(Phaser.Text.prototype); +// SpeechBubble.prototype.constructor = SpeechBubble; + +SpeechBubble = function(x, y) { + var textStyle = { font: "normal 24px Arial", fill: "#ff0", boundsAlignH: "center", boundsAlignV: "middle" }; + + this.speechBubbleText = game.add.text(0, 0, "맛없어!!!", textStyle); + this.speechBubbleText.addColor("#f00", 0); + this.speechBubbleText.anchor.setTo(0.5, 0.4); + this.speechBubbleText.scale.set(1.7); + + this.speechBubble = game.add.image(x, y, 'speech_bubble_angry'); + this.speechBubble.addChild(this.speechBubbleText); + this.speechBubble.anchor.set(0.5); + this.speechBubble.scale.set(0.7); + this.speechBubble.inputEnabled = false; +} + +SpeechBubble.prototype.update = function() { + this.y -= 0.3; +} + +SpeechBubble.prototype.showSpeechBubble = function(type) { + if(type == Meat.DONENESS_WELLDONE) { + this.speechBubbleText.addColor("#33f", 0); + this.speechBubble.loadTexture('speech_bubble_happy'); + this.speechBubbleText.text = "맛있어 ♥♡♥"; + } else { + this.speechBubble.loadTexture('speech_bubble_angry'); + + if(type == Meat.DONENESS_RARE) { + this.speechBubbleText.addColor("#f33", 0); + this.speechBubbleText.text = "날고기 싫어!!!"; + } else if(type == Meat.DONENESS_BURN_BLACK) { + this.speechBubbleText.addColor("#333", 0); + this.speechBubbleText.text = "탄 고기\n안먹을래!!!"; + } + } + + this.speechBubble.alpha = 1; + game.time.events.add(Phaser.Timer.SECOND * 1, this.hideSpeechBubble, this); +}, + +SpeechBubble.prototype.hideSpeechBubble = function() { + this.speechBubble.alpha = 0; +}, + +SpeechBubble.prototype.destroySelf = function() { + this.destroy(); +} + + diff --git a/src/web/client/grilled_meat.html b/src/web/client/grilled_meat.html index f4ce2eb..bffbb5d 100644 --- a/src/web/client/grilled_meat.html +++ b/src/web/client/grilled_meat.html @@ -40,6 +40,7 @@ +