diff --git a/src/game/mouse/grilled_meat/bonus_meat.js b/src/game/mouse/grilled_meat/bonus_meat.js index f84dd0a..19f9f45 100644 --- a/src/game/mouse/grilled_meat/bonus_meat.js +++ b/src/game/mouse/grilled_meat/bonus_meat.js @@ -44,7 +44,7 @@ BonusMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3; BonusMeat.SCORE_NAME_RARE = 1; BonusMeat.SCORE_NAME_WELLDONE = 5; -BonusMeat.SCORE_NAME_BURN_BLACK = 10; +BonusMeat.SCORE_NAME_BURN_BLACK = 1; BonusMeat.SPRITE_NAME_RARE = "bonus_meat"; BonusMeat.SPRITE_NAME_WELLDONE = "bonus_meat_welldone"; diff --git a/src/game/mouse/grilled_meat/game.js b/src/game/mouse/grilled_meat/game.js index d56b22d..681c37a 100644 --- a/src/game/mouse/grilled_meat/game.js +++ b/src/game/mouse/grilled_meat/game.js @@ -40,10 +40,16 @@ var Game = { ); this.setClickEnable(false); - this.stageTimer = new StageTimer( - Game.GAME_TIME_SEC, + this.makeStageTimerText(); + this.realtimeStageTimer = new RealtimeStageTimer(Game.GAME_TIME_SEC); + this.realtimeStageTimer.setTimeUpdateEvent( + (function(timeLeftSec) { + this.textTimer.text = TimeUtil.printHHMMSSFromSec(timeLeftSec); + }).bind(this) + ); + this.realtimeStageTimer.setTimeOverEvent( (function() { - this.setClickEnable(false); + this.textTimer.text = "타임 오버"; this.timeOver(); }).bind(this) ); @@ -62,11 +68,6 @@ var Game = { this.meatPlate.anchor.set(0.5); this.meatPlate.smoothed = false; - // this.heatPlate = game.add.image(game.world.centerX, HeatPlate.POSITION_Y, 'heat_plate'); - // this.heatPlate.anchor.set(0.5); - // this.heatPlate.smoothed = false; - // this.heatPlate.scale.set(1); - this.heatPlate = new HeatPlate(); this.stoveDial = new StoveDial(80, Game.HEAT_PLATE_POSITION_Y + 70); this.stoveDial.setOnChangeDialLevelHandler( @@ -75,9 +76,12 @@ var Game = { this.trashCan = new TrashCan(); - this.god = new God(God.POSITION_X, God.POSITION_Y, this); + this.god = new God(this); // meat + this.bonusMeat = new BonusMeat(this); + this.bonusMeat.setActive(false, -100, -100, ""); + this.meatGroup = game.add.group(); for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) { // var meat = new Meat(this); @@ -87,8 +91,6 @@ var Game = { this.meatGroup.add(meat); } - this.bonusMeat = new BonusMeat(this); - // this.bonusMeat.setActive(false, -100, -100, ""); var experienceAppTimer = new ExperienceAppTimer(); @@ -124,6 +126,19 @@ var Game = { this.burnLevel = HeatPlate.BURN_LEVEL_WEAK; }, + makeStageTimerText: function() { + var fontStyle = { + font: "38px Arial", + align: "right", + boundsAlignH: "right", // left, center. right + boundsAlignV: "middle", // top, middle, bottom + fill: "#fff" + }; + this.textTimer = game.add.text(game.world.width - 300, 0, "", fontStyle) + .setTextBounds(0, 0, 200, 70); + this.textTimer.text = ""; + }, + onChangeDialLevel: function(dialLevel) { this.burnLevel = dialLevel; @@ -170,13 +185,14 @@ var Game = { this.playingStageNo = 1; this.startStage(); - this.stageTimer.start(); - + // this.stageTimer.start(); + this.realtimeStageTimer.start(); }, startStage: function() { this.clearedMeatCount = 0; this.badMeatCount = 0; + console.log("badMeatCount : " + this.badMeatCount); this.activatedMeatCount = this.getStageMeatCount(); this.serveMeats(); }, @@ -191,6 +207,12 @@ var Game = { }, serveMeats: function() { + if(this.playingStageNo > 1 && this.badMeatCount == 0 && this.bonusMeat.isActivate() == false) { + var randX = this.meatPlate.x - game.rnd.integerInRange(-100, 100); + var randY = this.meatPlate.y - game.rnd.integerInRange(-30, 30); + this.bonusMeat.setActive(true, randX, randY, ""); + } + for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) { var meat = this.meatGroup.children[i]; meat.setActive(false, -100, -100, ""); @@ -258,25 +280,20 @@ var Game = { }, godEatMeat: function(meat) { - // console.log("isOverGod : " + x + ", " + y + ", " + width + ", " + height); - - // console.log("god eat : " + meat); - // console.log("meat grade : " + meat.getMeatGrade()); - var meatClassName = meat.getClassName(); if(meat.getMeatGrade() == MeatBase.DONENESS_WELLDONE) { - // this.god.animateHappy(MeatBase.DONENESS_WELLDONE, meatClassName, meat.getTotalCookingTime()); this.god.animateHappy(meat); - // var score = this.getScore(); var score = meat.getScore(); this.scoreManager.plusScore(score); var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score); this.plusScoreGroup.add(tempPlusScore); } else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) { - // this.god.animateAngryWithRare(MeatBase.DONENESS_RARE, meatClassName, meat.getTotalCookingTime()); + this.badMeatCount++; + console.log("badMeatCount : " + this.badMeatCount); + this.god.animateAngryWithRare(meat); // var score = this.getScore(); @@ -287,18 +304,11 @@ var Game = { var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score); this.plusScoreGroup.add(tempPlusScore); } - } else { + } else { // meat is burn black this.badMeatCount++; + console.log("badMeatCount : " + this.badMeatCount); - // this.god.animateAngryWithBurnBlack(MeatBase.DONENESS_BURN_BLACK, meatClassName, meat.getTotalCookingTime()); this.god.animateAngryWithBurnBlack(meat); - /* - if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) { - this.god.animateAngry(MeatBase.DONENESS_RARE); // "날고기 싫어!!!"); - } else { // MeatBase.DONENESS_BURN_BLACK - this.god.animateAngry(MeatBase.DONENESS_BURN_BLACK); // "탄 고기 안먹어!!!"); - } - */ return; // god doesn't eat burned black meat } @@ -314,8 +324,6 @@ var Game = { }, isOverTrashCan: function(x, y) { - // console.log("isOverTrashCan : " + x + ", " + y + ", " + width + ", " + height); - var trashCanHalfWidth = this.trashCan.width / 2; var trashCanHalfHeight = this.trashCan.height; @@ -333,29 +341,31 @@ var Game = { }, throwAway: function(meat) { - // console.log("throw meat"); - if(meat.getMeatGrade() == MeatBase.DONENESS_BURN_BLACK) { - this.trashCan.animateAngry(); - meat.setActive(false, -100, -100, ''); + if(meat.getMeatGrade() != MeatBase.DONENESS_BURN_BLACK) + return; - var score = meat.getScore(); - this.scoreManager.plusScore(score); + this.badMeatCount++; + console.log("badMeatCount : " + this.badMeatCount); - var tempPlusScore = new PlusScore(this.trashCan.x, this.trashCan.y - 250, score); - this.plusScoreGroup.add(tempPlusScore); + this.trashCan.animateAngry(); + meat.setActive(false, -100, -100, ''); - var meatClassName = meat.getClassName(); - if(meatClassName == NormalMeat.CLASS_NAME) { - this.clearedMeatCount++; - if(this.clearedMeatCount == this.activatedMeatCount) { - this.clearStage(); - } + var score = meat.getScore(); + this.scoreManager.plusScore(score); + + var tempPlusScore = new PlusScore(this.trashCan.x, this.trashCan.y - 180, score); + this.plusScoreGroup.add(tempPlusScore); + + if(meat.getClassName() == NormalMeat.CLASS_NAME) { + this.clearedMeatCount++; + if(this.clearedMeatCount == this.activatedMeatCount) { + this.clearStage(); } } }, clearStage: function() { - this.stageTimer.addBonusTime(this.getBonusTime()); + // this.stageTimer.addBonusTime(this.getBonusTime()); this.playingStageNo++; @@ -409,7 +419,7 @@ var Game = { } -Game.GAME_TIME_SEC = 60; +Game.GAME_TIME_SEC = 90; Game.NEXT_STAGE_DELAY_MS = 500; Game.MAX_MEAT_COUNT = 20; diff --git a/src/game/mouse/grilled_meat/god.js b/src/game/mouse/grilled_meat/god.js index 02a3ed7..d47e553 100644 --- a/src/game/mouse/grilled_meat/god.js +++ b/src/game/mouse/grilled_meat/god.js @@ -1,11 +1,11 @@ God.prototype = Object.create(Phaser.Sprite.prototype); God.prototype.constructor = God; -function God(x, y, mainGame) { +function God(mainGame) { this.mainGame = mainGame; this.isActivated = true; - Phaser.Sprite.call(this, game, x, y, 'god_angry'); + Phaser.Sprite.call(this, game, God.POSITION_X, God.POSITION_Y, 'god_angry'); this.anchor.setTo(0.5, 1); this.scale.set(0.5); @@ -16,16 +16,16 @@ function God(x, y, mainGame) { game.add.existing(this); this.speechBubble = new SpeechBubble(); - this.speechBubble.hideSpeechBubble(); + this.speechBubble.hide(); - this.makeParticles(x, y); + this.makeParticles(); } -God.prototype.makeParticles = function(x, y) { +God.prototype.makeParticles = function() { game.physics.startSystem(Phaser.Physics.ARCADE); - this.fullHeartEmitter = game.add.emitter(x, y - 170, 20); + this.fullHeartEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 170, 20); this.fullHeartEmitter.makeParticles("heart_full"); // this.fullHeartEmitter.minParticleScale = 0.5; // this.fullHeartEmitter.maxParticleScale = 0.7; @@ -51,7 +51,7 @@ God.prototype.makeParticles = function(x, y) { God.EFFECT_LIFE_TIME_MS, Phaser.Easing.Quadratic.Out, false ); - this.emptyHeartEmitter = game.add.emitter(x, y - 150, 20); + this.emptyHeartEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 150, 20); this.emptyHeartEmitter.makeParticles("heart_empty"); this.emptyHeartEmitter.minParticleScale = 0.5; this.emptyHeartEmitter.maxParticleScale = 0.7; @@ -59,7 +59,7 @@ God.prototype.makeParticles = function(x, y) { this.emptyHeartEmitter.maxParticleSpeed.setTo(150, -500); this.emptyHeartEmitter.gravity = 1500; - this.angryEmitter = game.add.emitter(x, y - 200, 20); + this.angryEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 200, 20); this.angryEmitter.makeParticles("smoke"); this.angryEmitter.width = God.HEAD_WIDTH; this.angryEmitter.height = God.HEAD_HEIGHT; diff --git a/src/game/mouse/grilled_meat/loading.js b/src/game/mouse/grilled_meat/loading.js index 1e310e6..a7a309c 100644 --- a/src/game/mouse/grilled_meat/loading.js +++ b/src/game/mouse/grilled_meat/loading.js @@ -69,6 +69,8 @@ var Loading = { game.load.image('god_smile', '../../../resources/image/character/god/god_smile.png'); game.load.image('god_happy', '../../../resources/image/character/god/god_happy.png'); + game.load.image('waiter', '../../../resources/image/character/god/god_smile.png'); + // game.load.image('a', '../../../resources/image/icon/fullscreen_white.png'); // game.load.image('b', '../../../resources/image/icon/fullscreen_white.png'); // game.load.image('c', '../../../resources/image/icon/fullscreen_white.png'); diff --git a/src/game/mouse/grilled_meat/meat_base.js b/src/game/mouse/grilled_meat/meat_base.js index 6c20563..fdb1da5 100644 --- a/src/game/mouse/grilled_meat/meat_base.js +++ b/src/game/mouse/grilled_meat/meat_base.js @@ -214,6 +214,9 @@ MeatBase.prototype.hide = function() { this.stopCook(); } +MeatBase.prototype.isActivate = function() { + return this.isActivated; +} MeatBase.prototype.startCook = function() { @@ -347,5 +350,5 @@ MeatBase.DONENESS_WELLDONE = 1; MeatBase.DONENESS_BURN_BLACK = 2; MeatBase.DONENESS_NONE = 3; -MeatBase.COOK_TIME_WELLDONE = 20; -MeatBase.COOK_TIME_BURN = 40; \ No newline at end of file +MeatBase.COOK_TIME_WELLDONE = 200; +MeatBase.COOK_TIME_BURN = 400; \ No newline at end of file diff --git a/src/game/mouse/grilled_meat/normal_meat.js b/src/game/mouse/grilled_meat/normal_meat.js index 50dde0d..4a899cb 100644 --- a/src/game/mouse/grilled_meat/normal_meat.js +++ b/src/game/mouse/grilled_meat/normal_meat.js @@ -63,7 +63,7 @@ NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3; NormalMeat.SCORE_NAME_RARE = 1; NormalMeat.SCORE_NAME_WELLDONE = 2; -NormalMeat.SCORE_NAME_BURN_BLACK = 10; +NormalMeat.SCORE_NAME_BURN_BLACK = 1; NormalMeat.SPRITE_NAME_RARE = "meat"; NormalMeat.SPRITE_NAME_WELLDONE = "meat_welldone"; diff --git a/src/game/mouse/grilled_meat/speech_bubble.js b/src/game/mouse/grilled_meat/speech_bubble.js index 8d1c08d..048b549 100644 --- a/src/game/mouse/grilled_meat/speech_bubble.js +++ b/src/game/mouse/grilled_meat/speech_bubble.js @@ -36,7 +36,7 @@ SpeechBubble.prototype.showSpeechBubble = function(meat) { } else { this.speechBubbleText.addColor("#33f", 0); this.loadTexture('speech_bubble_happy'); - this.speechBubbleText.text = "덜 익은 고기\n맛 없어! ㅠㅠ"; + this.speechBubbleText.text = "덜 익었어!!!"; } break; @@ -59,10 +59,22 @@ SpeechBubble.prototype.startAnimation = function() { tween.to({x:0.7, y:0.7}, 200, Phaser.Easing.Linear.None, true, 0); tween.start(); - game.time.events.add(Phaser.Timer.SECOND * 1, this.hideSpeechBubble, this); + game.time.events.add(Phaser.Timer.SECOND * 1, this.hide, this); } -SpeechBubble.prototype.hideSpeechBubble = function() { + +SpeechBubble.prototype.setupWaiterSpeechBubble = function(meat) { + this.speechBubbleText.addColor("#33f", 0); + this.loadTexture('speech_bubble_happy'); + this.speechBubbleText.text = "맛있게 드세요!"; +} + + +SpeechBubble.prototype.show = function() { + this.alpha = 1; +} + +SpeechBubble.prototype.hide = function() { this.alpha = 0; } diff --git a/src/game/mouse/grilled_meat/waiter.js b/src/game/mouse/grilled_meat/waiter.js new file mode 100644 index 0000000..5c45fca --- /dev/null +++ b/src/game/mouse/grilled_meat/waiter.js @@ -0,0 +1,53 @@ +Waiter.prototype = Object.create(Phaser.Sprite.prototype); +Waiter.prototype.constructor = Waiter; + +function Waiter() { + this.isActivated = true; + + Phaser.Sprite.call(this, game, Waiter.POSITION_X, Waiter.POSITION_Y, 'waiter'); + this.anchor.setTo(0.5, 1); + this.scale.set(0.5); + + this.inputEnabled = false; + // this.input.enableDrag(false); + // this.events.onInputDown.add(this.onDown, this); + + game.add.existing(this); + + this.speechBubble = new SpeechBubble(); + this.speechBubble.setupWaiterSpeechBubble(); + this.speechBubble.hideSpeechBubble(); +} + + +Waiter.prototype.animateServing = function() { + this.speechBubble.show(); + + this.show(); + var tween = game.add.tween(this.x); + tween.to(200, 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); + tween.onComplete.add(this.smileAgain, this); + tween.start(); + + + game.time.events.add(Phaser.Timer.SECOND * 1, this.hide, this); +} + + +Waiter.prototype.hide = function() { + this.alpha = 0; + this.x = -100; +} + +Waiter.prototype.show = function() { + this.x = -100; + this.alpha = 1; +} + + + + +Waiter.POSITION_X = GAME_SCREEN_SIZE.x - 120; +Waiter.POSITION_Y = 340; \ No newline at end of file diff --git a/src/web/client/grilled_meat.html b/src/web/client/grilled_meat.html index 65635a7..55766d6 100644 --- a/src/web/client/grilled_meat.html +++ b/src/web/client/grilled_meat.html @@ -43,6 +43,8 @@ + + @@ -59,11 +61,12 @@ - + +