Fix: move burn black meat to the trash can

This commit is contained in:
2019-12-10 20:46:43 +09:00
parent fd13296cdf
commit f1c4d918a8
9 changed files with 147 additions and 64 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ BonusMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3;
BonusMeat.SCORE_NAME_RARE = 1; BonusMeat.SCORE_NAME_RARE = 1;
BonusMeat.SCORE_NAME_WELLDONE = 5; 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_RARE = "bonus_meat";
BonusMeat.SPRITE_NAME_WELLDONE = "bonus_meat_welldone"; BonusMeat.SPRITE_NAME_WELLDONE = "bonus_meat_welldone";
+58 -48
View File
@@ -40,10 +40,16 @@ var Game = {
); );
this.setClickEnable(false); this.setClickEnable(false);
this.stageTimer = new StageTimer( this.makeStageTimerText();
Game.GAME_TIME_SEC, 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() { (function() {
this.setClickEnable(false); this.textTimer.text = "타임 오버";
this.timeOver(); this.timeOver();
}).bind(this) }).bind(this)
); );
@@ -62,11 +68,6 @@ var Game = {
this.meatPlate.anchor.set(0.5); this.meatPlate.anchor.set(0.5);
this.meatPlate.smoothed = false; 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.heatPlate = new HeatPlate();
this.stoveDial = new StoveDial(80, Game.HEAT_PLATE_POSITION_Y + 70); this.stoveDial = new StoveDial(80, Game.HEAT_PLATE_POSITION_Y + 70);
this.stoveDial.setOnChangeDialLevelHandler( this.stoveDial.setOnChangeDialLevelHandler(
@@ -75,9 +76,12 @@ var Game = {
this.trashCan = new TrashCan(); this.trashCan = new TrashCan();
this.god = new God(God.POSITION_X, God.POSITION_Y, this); this.god = new God(this);
// meat // meat
this.bonusMeat = new BonusMeat(this);
this.bonusMeat.setActive(false, -100, -100, "");
this.meatGroup = game.add.group(); this.meatGroup = game.add.group();
for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) { for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) {
// var meat = new Meat(this); // var meat = new Meat(this);
@@ -87,8 +91,6 @@ var Game = {
this.meatGroup.add(meat); this.meatGroup.add(meat);
} }
this.bonusMeat = new BonusMeat(this);
// this.bonusMeat.setActive(false, -100, -100, "");
var experienceAppTimer = new ExperienceAppTimer(); var experienceAppTimer = new ExperienceAppTimer();
@@ -124,6 +126,19 @@ var Game = {
this.burnLevel = HeatPlate.BURN_LEVEL_WEAK; 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) { onChangeDialLevel: function(dialLevel) {
this.burnLevel = dialLevel; this.burnLevel = dialLevel;
@@ -170,13 +185,14 @@ var Game = {
this.playingStageNo = 1; this.playingStageNo = 1;
this.startStage(); this.startStage();
this.stageTimer.start(); // this.stageTimer.start();
this.realtimeStageTimer.start();
}, },
startStage: function() { startStage: function() {
this.clearedMeatCount = 0; this.clearedMeatCount = 0;
this.badMeatCount = 0; this.badMeatCount = 0;
console.log("badMeatCount : " + this.badMeatCount);
this.activatedMeatCount = this.getStageMeatCount(); this.activatedMeatCount = this.getStageMeatCount();
this.serveMeats(); this.serveMeats();
}, },
@@ -191,6 +207,12 @@ var Game = {
}, },
serveMeats: function() { 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++) { for(var i = 0; i < Game.MAX_MEAT_COUNT; i++) {
var meat = this.meatGroup.children[i]; var meat = this.meatGroup.children[i];
meat.setActive(false, -100, -100, ""); meat.setActive(false, -100, -100, "");
@@ -258,25 +280,20 @@ var Game = {
}, },
godEatMeat: function(meat) { 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(); var meatClassName = meat.getClassName();
if(meat.getMeatGrade() == MeatBase.DONENESS_WELLDONE) { if(meat.getMeatGrade() == MeatBase.DONENESS_WELLDONE) {
// this.god.animateHappy(MeatBase.DONENESS_WELLDONE, meatClassName, meat.getTotalCookingTime());
this.god.animateHappy(meat); this.god.animateHappy(meat);
// var score = this.getScore();
var score = meat.getScore(); var score = meat.getScore();
this.scoreManager.plusScore(score); this.scoreManager.plusScore(score);
var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score); var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score);
this.plusScoreGroup.add(tempPlusScore); this.plusScoreGroup.add(tempPlusScore);
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) { } 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); this.god.animateAngryWithRare(meat);
// var score = this.getScore(); // var score = this.getScore();
@@ -287,18 +304,11 @@ var Game = {
var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score); var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score);
this.plusScoreGroup.add(tempPlusScore); this.plusScoreGroup.add(tempPlusScore);
} }
} else { } else { // meat is burn black
this.badMeatCount++; this.badMeatCount++;
console.log("badMeatCount : " + this.badMeatCount);
// this.god.animateAngryWithBurnBlack(MeatBase.DONENESS_BURN_BLACK, meatClassName, meat.getTotalCookingTime());
this.god.animateAngryWithBurnBlack(meat); 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 return; // god doesn't eat burned black meat
} }
@@ -314,8 +324,6 @@ var Game = {
}, },
isOverTrashCan: function(x, y) { isOverTrashCan: function(x, y) {
// console.log("isOverTrashCan : " + x + ", " + y + ", " + width + ", " + height);
var trashCanHalfWidth = this.trashCan.width / 2; var trashCanHalfWidth = this.trashCan.width / 2;
var trashCanHalfHeight = this.trashCan.height; var trashCanHalfHeight = this.trashCan.height;
@@ -333,29 +341,31 @@ var Game = {
}, },
throwAway: function(meat) { throwAway: function(meat) {
// console.log("throw meat"); if(meat.getMeatGrade() != MeatBase.DONENESS_BURN_BLACK)
if(meat.getMeatGrade() == MeatBase.DONENESS_BURN_BLACK) { return;
this.trashCan.animateAngry();
meat.setActive(false, -100, -100, '');
var score = meat.getScore(); this.badMeatCount++;
this.scoreManager.plusScore(score); console.log("badMeatCount : " + this.badMeatCount);
var tempPlusScore = new PlusScore(this.trashCan.x, this.trashCan.y - 250, score); this.trashCan.animateAngry();
this.plusScoreGroup.add(tempPlusScore); meat.setActive(false, -100, -100, '');
var meatClassName = meat.getClassName(); var score = meat.getScore();
if(meatClassName == NormalMeat.CLASS_NAME) { this.scoreManager.plusScore(score);
this.clearedMeatCount++;
if(this.clearedMeatCount == this.activatedMeatCount) { var tempPlusScore = new PlusScore(this.trashCan.x, this.trashCan.y - 180, score);
this.clearStage(); this.plusScoreGroup.add(tempPlusScore);
}
if(meat.getClassName() == NormalMeat.CLASS_NAME) {
this.clearedMeatCount++;
if(this.clearedMeatCount == this.activatedMeatCount) {
this.clearStage();
} }
} }
}, },
clearStage: function() { clearStage: function() {
this.stageTimer.addBonusTime(this.getBonusTime()); // this.stageTimer.addBonusTime(this.getBonusTime());
this.playingStageNo++; 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.NEXT_STAGE_DELAY_MS = 500;
Game.MAX_MEAT_COUNT = 20; Game.MAX_MEAT_COUNT = 20;
+8 -8
View File
@@ -1,11 +1,11 @@
God.prototype = Object.create(Phaser.Sprite.prototype); God.prototype = Object.create(Phaser.Sprite.prototype);
God.prototype.constructor = God; God.prototype.constructor = God;
function God(x, y, mainGame) { function God(mainGame) {
this.mainGame = mainGame; this.mainGame = mainGame;
this.isActivated = true; 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.anchor.setTo(0.5, 1);
this.scale.set(0.5); this.scale.set(0.5);
@@ -16,16 +16,16 @@ function God(x, y, mainGame) {
game.add.existing(this); game.add.existing(this);
this.speechBubble = new SpeechBubble(); 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); 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.makeParticles("heart_full");
// this.fullHeartEmitter.minParticleScale = 0.5; // this.fullHeartEmitter.minParticleScale = 0.5;
// this.fullHeartEmitter.maxParticleScale = 0.7; // 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 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.makeParticles("heart_empty");
this.emptyHeartEmitter.minParticleScale = 0.5; this.emptyHeartEmitter.minParticleScale = 0.5;
this.emptyHeartEmitter.maxParticleScale = 0.7; this.emptyHeartEmitter.maxParticleScale = 0.7;
@@ -59,7 +59,7 @@ God.prototype.makeParticles = function(x, y) {
this.emptyHeartEmitter.maxParticleSpeed.setTo(150, -500); this.emptyHeartEmitter.maxParticleSpeed.setTo(150, -500);
this.emptyHeartEmitter.gravity = 1500; 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.makeParticles("smoke");
this.angryEmitter.width = God.HEAD_WIDTH; this.angryEmitter.width = God.HEAD_WIDTH;
this.angryEmitter.height = God.HEAD_HEIGHT; this.angryEmitter.height = God.HEAD_HEIGHT;
+2
View File
@@ -69,6 +69,8 @@ var Loading = {
game.load.image('god_smile', '../../../resources/image/character/god/god_smile.png'); 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('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('a', '../../../resources/image/icon/fullscreen_white.png');
// game.load.image('b', '../../../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'); // game.load.image('c', '../../../resources/image/icon/fullscreen_white.png');
+5 -2
View File
@@ -214,6 +214,9 @@ MeatBase.prototype.hide = function() {
this.stopCook(); this.stopCook();
} }
MeatBase.prototype.isActivate = function() {
return this.isActivated;
}
MeatBase.prototype.startCook = function() { MeatBase.prototype.startCook = function() {
@@ -347,5 +350,5 @@ MeatBase.DONENESS_WELLDONE = 1;
MeatBase.DONENESS_BURN_BLACK = 2; MeatBase.DONENESS_BURN_BLACK = 2;
MeatBase.DONENESS_NONE = 3; MeatBase.DONENESS_NONE = 3;
MeatBase.COOK_TIME_WELLDONE = 20; MeatBase.COOK_TIME_WELLDONE = 200;
MeatBase.COOK_TIME_BURN = 40; MeatBase.COOK_TIME_BURN = 400;
+1 -1
View File
@@ -63,7 +63,7 @@ NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3;
NormalMeat.SCORE_NAME_RARE = 1; NormalMeat.SCORE_NAME_RARE = 1;
NormalMeat.SCORE_NAME_WELLDONE = 2; 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_RARE = "meat";
NormalMeat.SPRITE_NAME_WELLDONE = "meat_welldone"; NormalMeat.SPRITE_NAME_WELLDONE = "meat_welldone";
+15 -3
View File
@@ -36,7 +36,7 @@ SpeechBubble.prototype.showSpeechBubble = function(meat) {
} else { } else {
this.speechBubbleText.addColor("#33f", 0); this.speechBubbleText.addColor("#33f", 0);
this.loadTexture('speech_bubble_happy'); this.loadTexture('speech_bubble_happy');
this.speechBubbleText.text = "덜 익은 고기\n맛 없어! ㅠㅠ"; this.speechBubbleText.text = "덜 익었어!!!";
} }
break; 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.to({x:0.7, y:0.7}, 200, Phaser.Easing.Linear.None, true, 0);
tween.start(); 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; this.alpha = 0;
} }
+53
View File
@@ -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;
+4 -1
View File
@@ -43,6 +43,8 @@
<!-- library source files --> <!-- library source files -->
<script src="../../game/lib/util/number_util.js"></script> <script src="../../game/lib/util/number_util.js"></script>
<script src="../../game/lib/util/record_util.js"></script> <script src="../../game/lib/util/record_util.js"></script>
<script src="../../game/lib/util/string_util.js"></script>
<script src="../../game/lib/util/time_util.js"></script>
<script src="../../game/lib/text/input_type_text.js"></script> <script src="../../game/lib/text/input_type_text.js"></script>
<script src="../../game/lib/text/time_over_text.js"></script> <script src="../../game/lib/text/time_over_text.js"></script>
@@ -59,11 +61,12 @@
<script src="../../game/lib/button/fullscreen_button.js"></script> <script src="../../game/lib/button/fullscreen_button.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script> <script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/experience_app_timer.js"></script> <script src="../../game/lib/experience_app_timer.js"></script>
<script src="../../game/lib/stage_timer.js"></script> <script src="../../game/lib/realtime_stage_timer.js"></script>
<!-- Grilled meat : source files --> <!-- Grilled meat : source files -->
<script src="../../game/mouse/grilled_meat/loading.js"></script> <script src="../../game/mouse/grilled_meat/loading.js"></script>
<script src="../../game/mouse/grilled_meat/waiter.js"></script>
<script src="../../game/mouse/grilled_meat/god.js"></script> <script src="../../game/mouse/grilled_meat/god.js"></script>
<script src="../../game/mouse/grilled_meat/speech_bubble.js"></script> <script src="../../game/mouse/grilled_meat/speech_bubble.js"></script>
<script src="../../game/mouse/grilled_meat/plus_score.js"></script> <script src="../../game/mouse/grilled_meat/plus_score.js"></script>