Fix: MeatBase - NormalMeat - BonusMeat

This commit is contained in:
2019-12-10 07:49:23 +09:00
parent 36298d7621
commit f77057ed8e
4 changed files with 51 additions and 44 deletions
+24 -25
View File
@@ -9,29 +9,35 @@ function MeatBase() {
this.initMeatTypeVariables();
this.initMouseEventHandler();
this.whiteSmokeParticle = new Smoke(Meat.DONENESS_RARE, 0, 0);
this.redSmokeParticle = new Smoke(Meat.DONENESS_WELLDONE, 0, 0);
this.blackSmokeParticle = new Smoke(Meat.DONENESS_BURN_BLACK, 0, 0);
}
MeatBase.prototype.update = function() {
var posY = this.y;
if(posY <= God.POSITION_Y) {
this.scale.set(0.4);
this.scale.set(this.baseScale);
} else if(posY > God.POSITION_Y && posY < HeatPlate.POSITION_Y) {
var scaleRate = (posY - God.POSITION_Y) / (HeatPlate.POSITION_Y - God.POSITION_Y);
this.scale.set(0.4 + 0.3 * scaleRate);
this.scale.set(this.baseScale + 0.3 * scaleRate);
} else {
this.scale.set(0.4 + 0.3);
this.scale.set(this.baseScale + 0.3);
}
// if(this.isOnHeatPlate == true && game.input.mousePointer.isUp == true) {
// this.cooking();
// }
if(this.isOnHeatPlate == true && game.input.mousePointer.isUp == true) {
this.cooking();
}
}
MeatBase.prototype.initMeatTypeVariables = function() {
this.cookingSpeed = 0.0;
this.baseScale = 0.5;
this.rareScore = 0;
this.welldoneScore = 0;
this.burnBlackScore = 0;
@@ -107,15 +113,8 @@ MeatBase.prototype.isInClickArea = function(downX, downY, upX, upY) {
}
MeatBase.prototype.onClickListener = function(pointer) {
console.log("onClickListener");
// console.log("onClickListener");
if(this.isFront() == true)
this.flipToBack()
else
this.flipToFront();
// console.log("flip cooking side : " + this.cookingSide);
/*
if(this.mainGame.isOverHeatPlate(this.x, this.y, this.width, this.height) == true) {
if(this.isFront() == true)
this.flipToBack()
@@ -125,13 +124,11 @@ MeatBase.prototype.onClickListener = function(pointer) {
this.startCook();
}
*/
}
MeatBase.prototype.onDragStopListener = function(pointer) {
console.log("onDragStop");
// console.log("onDragStop");
/*
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();
@@ -143,7 +140,6 @@ MeatBase.prototype.onDragStopListener = function(pointer) {
// console.log("isOverGod : " + isOverGod(this.x, this.y));
this.mainGame.godEatMeat(this);
}
*/
}
@@ -162,7 +158,7 @@ MeatBase.prototype.flipToFront = function() {
this.angle = MeatBase.ANGLE_FRONT;
// console.log("flipToFront");
// console.log("back : " + this.getMeatGradeBySide(MeatBase.MEAT_BACK) + ", front : " + this.getMeatGradeBySide(MeatBase.MEAT_FRONT));
this.updateSprite();
this.upsideDownSprite(MeatBase.MEAT_FRONT);
}
MeatBase.prototype.flipToBack = function() {
@@ -172,15 +168,18 @@ MeatBase.prototype.flipToBack = function() {
this.angle = MeatBase.ANGLE_BACK;
// console.log("flipToBack");
// console.log("back : " + this.getMeatGradeBySide(MeatBase.MEAT_BACK) + ", front : " + this.getMeatGradeBySide(MeatBase.MEAT_FRONT));
this.updateSprite();
this.upsideDownSprite(MeatBase.MEAT_BACK);
}
MeatBase.prototype.updateSprite = function() {
if(this.getMeatGradeBySide(MeatBase.MEAT_FRONT) == MeatBase.DONENESS_BURN_BLACK) {
MeatBase.prototype.upsideDownSprite = function(meatDirection) {
if(this.getMeatGradeBySide(meatDirection) == MeatBase.DONENESS_BURN_BLACK) {
// console.log("sprite burn black");
this.loadTexture(this.spriteNameBurnBlack);
} else if(this.getMeatGradeBySide(MeatBase.MEAT_FRONT) == MeatBase.DONENESS_WELLDONE) {
} else if(this.getMeatGradeBySide(meatDirection) == MeatBase.DONENESS_WELLDONE) {
// console.log("sprite welldone");
this.loadTexture(this.spriteNameWelldone);
} else {
// console.log("sprite rare");
this.loadTexture(this.spriteNameRare);
}
}
@@ -248,7 +247,7 @@ MeatBase.prototype.setActive = function(isActivated, x, y, meat_type) {
this.x = x;
this.y = y;
this.loadTexture('meat1');
this.loadTexture(this.spriteNameRare);
this.angle = MeatBase.ANGLE_NONE;
this.alpha = 1;
}
@@ -327,5 +326,5 @@ MeatBase.ANGLE_NONE = 0;
MeatBase.ANGLE_FRONT = 30;
MeatBase.ANGLE_BACK = -30;
MeatBase.COOK_TIME_WELLDONE = 200;
MeatBase.COOK_TIME_WELLDONE = 20;
MeatBase.COOK_TIME_BURN = 400;