Add: trash can eats burned black meat
This commit is contained in:
@@ -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 = 0;
|
||||
BonusMeat.SCORE_NAME_BURN_BLACK = 10;
|
||||
|
||||
BonusMeat.SPRITE_NAME_RARE = "bonus_meat";
|
||||
BonusMeat.SPRITE_NAME_WELLDONE = "bonus_meat_welldone";
|
||||
|
||||
@@ -239,7 +239,7 @@ var Game = {
|
||||
return true;
|
||||
},
|
||||
|
||||
isOverGod: function(x, y, width, height) {
|
||||
isOverGod: function(x, y) {
|
||||
// console.log("isOverGod : " + x + ", " + y + ", " + width + ", " + height);
|
||||
|
||||
var godHalfWidth = (this.god.width - Game.GOD_OUT_OF_FACE_WIDTH) / 2;
|
||||
@@ -265,8 +265,8 @@ var Game = {
|
||||
|
||||
var meatClassName = meat.getClassName();
|
||||
|
||||
if(meat.getMeatGrade() == Meat.DONENESS_WELLDONE) {
|
||||
// this.god.animateHappy(Meat.DONENESS_WELLDONE, meatClassName, meat.getTotalCookingTime());
|
||||
if(meat.getMeatGrade() == MeatBase.DONENESS_WELLDONE) {
|
||||
// this.god.animateHappy(MeatBase.DONENESS_WELLDONE, meatClassName, meat.getTotalCookingTime());
|
||||
this.god.animateHappy(meat);
|
||||
|
||||
// var score = this.getScore();
|
||||
@@ -275,8 +275,8 @@ var Game = {
|
||||
|
||||
var tempPlusScore = new PlusScore(this.god.x, this.god.y - 250, score);
|
||||
this.plusScoreGroup.add(tempPlusScore);
|
||||
} else if(meat.getMeatGrade() == Meat.DONENESS_RARE) {
|
||||
// this.god.animateAngryWithRare(Meat.DONENESS_RARE, meatClassName, meat.getTotalCookingTime());
|
||||
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
|
||||
// this.god.animateAngryWithRare(MeatBase.DONENESS_RARE, meatClassName, meat.getTotalCookingTime());
|
||||
this.god.animateAngryWithRare(meat);
|
||||
|
||||
// var score = this.getScore();
|
||||
@@ -290,15 +290,17 @@ var Game = {
|
||||
} else {
|
||||
this.badMeatCount++;
|
||||
|
||||
// this.god.animateAngryWithBurnBlack(Meat.DONENESS_BURN_BLACK, meatClassName, meat.getTotalCookingTime());
|
||||
// this.god.animateAngryWithBurnBlack(MeatBase.DONENESS_BURN_BLACK, meatClassName, meat.getTotalCookingTime());
|
||||
this.god.animateAngryWithBurnBlack(meat);
|
||||
/*
|
||||
if(meat.getMeatGrade() == Meat.DONENESS_RARE) {
|
||||
this.god.animateAngry(Meat.DONENESS_RARE); // "날고기 싫어!!!");
|
||||
} else { // Meat.DONENESS_BURN_BLACK
|
||||
this.god.animateAngry(Meat.DONENESS_BURN_BLACK); // "탄 고기 안먹어!!!");
|
||||
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
|
||||
}
|
||||
|
||||
meat.setActive(false, -100, -100, '');
|
||||
@@ -311,6 +313,47 @@ var Game = {
|
||||
}
|
||||
},
|
||||
|
||||
isOverTrashCan: function(x, y) {
|
||||
// console.log("isOverTrashCan : " + x + ", " + y + ", " + width + ", " + height);
|
||||
|
||||
var trashCanHalfWidth = this.trashCan.width / 2;
|
||||
var trashCanHalfHeight = this.trashCan.height;
|
||||
|
||||
if(x < this.trashCan.x - trashCanHalfWidth) {
|
||||
return false;
|
||||
} else if(this.trashCan.x + trashCanHalfWidth < x) {
|
||||
return false;
|
||||
} else if(y < this.trashCan.y - this.trashCan.height) {
|
||||
return false;
|
||||
} else if(this.trashCan.y < y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
throwAway: function(meat) {
|
||||
// console.log("throw meat");
|
||||
if(meat.getMeatGrade() == MeatBase.DONENESS_BURN_BLACK) {
|
||||
this.trashCan.animateAngry();
|
||||
meat.setActive(false, -100, -100, '');
|
||||
|
||||
var score = meat.getScore();
|
||||
this.scoreManager.plusScore(score);
|
||||
|
||||
var tempPlusScore = new PlusScore(this.trashCan.x, this.trashCan.y - 250, score);
|
||||
this.plusScoreGroup.add(tempPlusScore);
|
||||
|
||||
var meatClassName = meat.getClassName();
|
||||
if(meatClassName == NormalMeat.CLASS_NAME) {
|
||||
this.clearedMeatCount++;
|
||||
if(this.clearedMeatCount == this.activatedMeatCount) {
|
||||
this.clearStage();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
clearStage: function() {
|
||||
this.stageTimer.addBonusTime(this.getBonusTime());
|
||||
|
||||
|
||||
@@ -137,6 +137,8 @@ MeatBase.prototype.onDragStopListener = function(pointer) {
|
||||
if(this.mainGame.isOverGod(this.x, this.y) == true) {
|
||||
// console.log("isOverGod : " + isOverGod(this.x, this.y));
|
||||
this.mainGame.godEatMeat(this);
|
||||
} else if(this.mainGame.isOverTrashCan(this.x, this.y) == true) {
|
||||
this.mainGame.throwAway(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +157,9 @@ MeatBase.prototype.getScore = function() {
|
||||
var scoreDoneness = this.scoreArray[meatDoneness];
|
||||
var totalCookingTime = this.getTotalCookingTime();
|
||||
|
||||
if(meatDoneness == MeatBase.DONENESS_BURN_BLACK)
|
||||
return scoreDoneness;
|
||||
|
||||
return scoreDoneness * totalCookingTime;
|
||||
}
|
||||
|
||||
@@ -343,4 +348,4 @@ MeatBase.DONENESS_BURN_BLACK = 2;
|
||||
MeatBase.DONENESS_NONE = 3;
|
||||
|
||||
MeatBase.COOK_TIME_WELLDONE = 20;
|
||||
MeatBase.COOK_TIME_BURN = 400;
|
||||
MeatBase.COOK_TIME_BURN = 40;
|
||||
@@ -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 = 0;
|
||||
NormalMeat.SCORE_NAME_BURN_BLACK = 10;
|
||||
|
||||
NormalMeat.SPRITE_NAME_RARE = "meat";
|
||||
NormalMeat.SPRITE_NAME_WELLDONE = "meat_welldone";
|
||||
|
||||
@@ -3,13 +3,27 @@ TrashCan.prototype.constructor = TrashCan;
|
||||
|
||||
function TrashCan() {
|
||||
Phaser.Sprite.call(this, game, TrashCan.POSITION_X, TrashCan.POSITION_Y, 'trash_can');
|
||||
this.anchor.set(0.5);
|
||||
this.anchor.set(0.5, 1);
|
||||
// this.scale.set(1);
|
||||
this.smoothed = false;
|
||||
this.inputEnabled = false;
|
||||
game.add.existing(this);
|
||||
}
|
||||
|
||||
TrashCan.prototype.animateAngry = function(meat) {
|
||||
var tween = game.add.tween(this.scale);
|
||||
tween.to({x:1.2, y:1.2}, 500, Phaser.Easing.Elastic.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();
|
||||
}
|
||||
|
||||
TrashCan.prototype.smileAgain = function() {
|
||||
this.scale.set(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TrashCan.POSITION_X = God.POSITION_X - 200;
|
||||
TrashCan.POSITION_Y = God.POSITION_Y - 30;
|
||||
TrashCan.POSITION_Y = God.POSITION_Y + 60;
|
||||
Reference in New Issue
Block a user