From 2448c9fd5513c1d0b8f75142964f109d17d72a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Tue, 10 Dec 2019 09:21:37 +0900 Subject: [PATCH] Add: bonus meat into game --- src/game/mouse/grilled_meat/bonus_meat.js | 18 +++++++++-- src/game/mouse/grilled_meat/game.js | 24 ++++++++++++--- src/game/mouse/grilled_meat/meat_base.js | 36 ++++++++++++++-------- src/game/mouse/grilled_meat/normal_meat.js | 18 +++++++++-- src/web/client/grilled_meat.html | 12 +++++--- 5 files changed, 81 insertions(+), 27 deletions(-) diff --git a/src/game/mouse/grilled_meat/bonus_meat.js b/src/game/mouse/grilled_meat/bonus_meat.js index 1caff24..658c8f2 100644 --- a/src/game/mouse/grilled_meat/bonus_meat.js +++ b/src/game/mouse/grilled_meat/bonus_meat.js @@ -12,7 +12,17 @@ function BonusMeat(mainGame) { BonusMeat.prototype.setBonusMeatTypeVariables = function() { - this.cookingSpeed = BonusMeat.COOKING_SPEED_BURN_LEVEL_WEAK; + this.className = BonusMeat.CLASS_NAME; + + this.cookingSpeedArray = []; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = BonusMeat.COOKING_SPEED_BURN_LEVEL_WEAK; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = BonusMeat.COOKING_SPEED_BURN_LEVEL_NORMAL; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = BonusMeat.COOKING_SPEED_BURN_LEVEL_STRONG; + + this.scoreArray = []; + this.scoreArray[MeatBase.DONENESS_RARE] = BonusMeat.SCORE_NAME_RARE; + this.scoreArray[MeatBase.DONENESS_WELLDONE] = BonusMeat.SCORE_NAME_WELLDONE; + this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = BonusMeat.SCORE_NAME_BURN_BLACK; } BonusMeat.prototype.setBonusMeatSprite = function() { @@ -26,12 +36,14 @@ BonusMeat.prototype.setBonusMeatSprite = function() { } +BonusMeat.CLASS_NAME = "BonusMeat"; + BonusMeat.COOKING_SPEED_BURN_LEVEL_WEAK = 0.1; BonusMeat.COOKING_SPEED_BURN_LEVEL_NORMAL = 0.2; BonusMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3; -BonusMeat.SCORE_NAME_RARE = 10; -BonusMeat.SCORE_NAME_WELLDONE = 100; +BonusMeat.SCORE_NAME_RARE = 1; +BonusMeat.SCORE_NAME_WELLDONE = 5; BonusMeat.SCORE_NAME_BURN_BLACK = 0; BonusMeat.SPRITE_NAME_RARE = "bonus_meat"; diff --git a/src/game/mouse/grilled_meat/game.js b/src/game/mouse/grilled_meat/game.js index 5447cce..4cf9f08 100644 --- a/src/game/mouse/grilled_meat/game.js +++ b/src/game/mouse/grilled_meat/game.js @@ -271,7 +271,17 @@ var Game = { if(meat.getMeatGrade() == Meat.DONENESS_WELLDONE) { this.god.animateHappy(Meat.DONENESS_WELLDONE); // "맛있어♥♡♥"); - var score = this.getScore(); + // var score = this.getScore(); + var score = meat.getScore(Meat.DONENESS_WELLDONE); + this.scoreManager.plusScore(score); + + var tempPlusScore = new PlusScore(this.god.x, this.god.y - 180, score); + this.plusScoreGroup.add(tempPlusScore); + } else if(meat.getMeatGrade() == Meat.DONENESS_RARE) { + this.god.animateAngry(Meat.DONENESS_RARE); // "날고기 싫어!!!"); + + // var score = this.getScore(); + var score = meat.getScore(Meat.DONENESS_WELLDONE); this.scoreManager.plusScore(score); var tempPlusScore = new PlusScore(this.god.x, this.god.y - 180, score); @@ -279,17 +289,23 @@ var Game = { } else { this.badMeatCount++; + this.god.animateAngry(Meat.DONENESS_BURN_BLACK); // "탄 고기 안먹어!!!"); + /* 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(); + + if(meat.getClassName() == NormalMeat.CLASS_NAME) { + this.clearedMeatCount++; + if(this.clearedMeatCount == this.activatedMeatCount) { + this.clearStage(); + } } }, diff --git a/src/game/mouse/grilled_meat/meat_base.js b/src/game/mouse/grilled_meat/meat_base.js index 973eb09..9c2678f 100644 --- a/src/game/mouse/grilled_meat/meat_base.js +++ b/src/game/mouse/grilled_meat/meat_base.js @@ -38,9 +38,7 @@ MeatBase.prototype.initMeatTypeVariables = function() { this.baseScale = 0.5; - this.rareScore = 0; - this.welldoneScore = 0; - this.burnBlackScore = 0; + this.className = "MeatBase"; } @@ -144,6 +142,18 @@ MeatBase.prototype.onDragStopListener = function(pointer) { +MeatBase.prototype.getClassName = function() { + return this.className; +} + +MeatBase.prototype.getScore = function(meatDoneness) { + var scoreDoneness = this.scoreArray[meatDoneness]; + var totalCookingTime = this.cookingTime[MeatBase.MEAT_BACK] + this.cookingTime[MeatBase.MEAT_FRONT]; + + console.log(totalCookingTime); + return scoreDoneness * totalCookingTime; +} + MeatBase.prototype.isFront = function() { if(this.cookingSide == MeatBase.MEAT_BACK) return true; @@ -313,18 +323,20 @@ MeatBase.prototype.changeAnimateSmokeColor = function(type) { } -MeatBase.MEAT_NONE = 0; -MeatBase.MEAT_FRONT = 1; -MeatBase.MEAT_BACK = 2; +MeatBase.CLASS_NAME = "MeatBase"; + +MeatBase.MEAT_NONE = 0; +MeatBase.MEAT_FRONT = 1; +MeatBase.MEAT_BACK = 2; + +MeatBase.ANGLE_NONE = 0; +MeatBase.ANGLE_FRONT = 30; +MeatBase.ANGLE_BACK = -30; MeatBase.DONENESS_RARE = 0; MeatBase.DONENESS_WELLDONE = 1; MeatBase.DONENESS_BURN_BLACK = 2; MeatBase.DONENESS_NONE = 3; -MeatBase.ANGLE_NONE = 0; -MeatBase.ANGLE_FRONT = 30; -MeatBase.ANGLE_BACK = -30; - -MeatBase.COOK_TIME_WELLDONE = 20; -MeatBase.COOK_TIME_BURN = 400; \ No newline at end of file +MeatBase.COOK_TIME_WELLDONE = 20; +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 6bcda42..5677489 100644 --- a/src/game/mouse/grilled_meat/normal_meat.js +++ b/src/game/mouse/grilled_meat/normal_meat.js @@ -13,7 +13,17 @@ function NormalMeat(mainGame) { NormalMeat.prototype.setNormalMeatTypeVariables = function() { - this.cookingSpeed = NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK; + this.className = NormalMeat.CLASS_NAME; + + this.cookingSpeedArray = []; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL; + this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG; + + this.scoreArray = []; + this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_NAME_RARE; + this.scoreArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.SCORE_NAME_WELLDONE; + this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.SCORE_NAME_BURN_BLACK; } NormalMeat.prototype.randomizeMeatType = function() { @@ -45,12 +55,14 @@ NormalMeat.prototype.setNormalMeatSprite = function() { +NormalMeat.CLASS_NAME = "NormalMeat"; + NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK = 0.1; NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL = 0.2; NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3; -NormalMeat.SCORE_NAME_RARE = 10; -NormalMeat.SCORE_NAME_WELLDONE = 100; +NormalMeat.SCORE_NAME_RARE = 1; +NormalMeat.SCORE_NAME_WELLDONE = 2; NormalMeat.SCORE_NAME_BURN_BLACK = 0; NormalMeat.SPRITE_NAME_RARE = "meat"; diff --git a/src/web/client/grilled_meat.html b/src/web/client/grilled_meat.html index e21244c..81637b2 100644 --- a/src/web/client/grilled_meat.html +++ b/src/web/client/grilled_meat.html @@ -65,17 +65,19 @@ - - - - - + + + + + + +