Fix: refactoring source codes
This commit is contained in:
@@ -74,7 +74,7 @@ var Game = {
|
|||||||
this.meatPlate.smoothed = false;
|
this.meatPlate.smoothed = false;
|
||||||
|
|
||||||
this.heatPlate = new HeatPlate();
|
this.heatPlate = new HeatPlate();
|
||||||
this.stoveDial = new StoveDial(80, Game.HEAT_PLATE_POSITION_Y + 70);
|
this.stoveDial = new StoveDial(80, HeatPlate.POSITION_Y + 70);
|
||||||
this.stoveDial.setOnChangeDialLevelHandler(
|
this.stoveDial.setOnChangeDialLevelHandler(
|
||||||
(function(dialLevel) { this.onChangeDialLevel(dialLevel); }).bind(this)
|
(function(dialLevel) { this.onChangeDialLevel(dialLevel); }).bind(this)
|
||||||
);
|
);
|
||||||
@@ -83,14 +83,14 @@ var Game = {
|
|||||||
|
|
||||||
// meat
|
// meat
|
||||||
this.bonusMeat = new BonusMeat(this);
|
this.bonusMeat = new BonusMeat(this);
|
||||||
this.bonusMeat.setActive(false, -100, -100, "");
|
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);
|
||||||
var meat = new NormalMeat(this);
|
var meat = new NormalMeat(this);
|
||||||
meat.name = "meat" + i;
|
meat.name = "meat" + i;
|
||||||
meat.setActive(false, -100, -100, "");
|
meat.setActive(false, -100, -100);
|
||||||
this.meatGroup.add(meat);
|
this.meatGroup.add(meat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,20 +186,21 @@ var Game = {
|
|||||||
|
|
||||||
startGame: function() {
|
startGame: function() {
|
||||||
this.playingStageNo = 1;
|
this.playingStageNo = 1;
|
||||||
|
this.clearedMeatCount = 0;
|
||||||
|
this.badMeatCount = 0;
|
||||||
|
|
||||||
this.startStage();
|
this.startStage();
|
||||||
// this.stageTimer.start();
|
|
||||||
this.realtimeStageTimer.start();
|
this.realtimeStageTimer.start();
|
||||||
},
|
},
|
||||||
|
|
||||||
startStage: function() {
|
startStage: function() {
|
||||||
this.clearedMeatCount = 0;
|
this.clearedMeatCount = 0;
|
||||||
this.badMeatCount = 0;
|
|
||||||
console.log("badMeatCount : " + this.badMeatCount);
|
|
||||||
this.activatedMeatCount = this.getStageMeatCount();
|
this.activatedMeatCount = this.getStageMeatCount();
|
||||||
this.serveBonusMeat();
|
|
||||||
this.serveNormalMeats();
|
this.serveNormalMeats();
|
||||||
|
|
||||||
|
this.serveBonusMeat();
|
||||||
|
this.badMeatCount = 0;
|
||||||
|
|
||||||
if(this.playingStageNo > 1)
|
if(this.playingStageNo > 1)
|
||||||
this.waiter.animateServing();
|
this.waiter.animateServing();
|
||||||
},
|
},
|
||||||
@@ -225,74 +226,31 @@ var Game = {
|
|||||||
|
|
||||||
var randX = this.meatPlate.x - game.rnd.integerInRange(-100, 100);
|
var randX = this.meatPlate.x - game.rnd.integerInRange(-100, 100);
|
||||||
var randY = this.meatPlate.y - game.rnd.integerInRange(-30, 30);
|
var randY = this.meatPlate.y - game.rnd.integerInRange(-30, 30);
|
||||||
this.bonusMeat.setActive(true, randX, randY, "");
|
this.bonusMeat.setActive(true, randX, randY);
|
||||||
},
|
},
|
||||||
|
|
||||||
serveNormalMeats: function() {
|
serveNormalMeats: function() {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i = 0; i < this.activatedMeatCount; i++) {
|
for(var i = 0; i < this.activatedMeatCount; i++) {
|
||||||
var meat = this.meatGroup.children[i];
|
var meat = this.meatGroup.children[i];
|
||||||
var randX = this.meatPlate.x - game.rnd.integerInRange(-100, 100);
|
var randX = this.meatPlate.x - game.rnd.integerInRange(-100, 100);
|
||||||
var randY = this.meatPlate.y - game.rnd.integerInRange(-30, 30);
|
var randY = this.meatPlate.y - game.rnd.integerInRange(-30, 30);
|
||||||
meat.setActive(true, randX, randY, "");
|
meat.setActive(true, randX, randY);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getScore: function() {
|
|
||||||
return this.playingStageNo * 10;
|
|
||||||
},
|
|
||||||
|
|
||||||
getBonusTime: function() {
|
|
||||||
if(this.badMeatCount > 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(this.playingStageNo == 1)
|
|
||||||
return 5;
|
|
||||||
else if(this.playingStageNo == 2)
|
|
||||||
return 7;
|
|
||||||
else
|
|
||||||
return 6 + this.playingStageNo;
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
|
isOverHeatPlate: function(x, y) {
|
||||||
isOverHeatPlate: function(x, y, width, height) {
|
return this.heatPlate.isOver(x, y);
|
||||||
var plateHalfWidth = (this.heatPlate.width - Game.HEAT_PLATE_HANDLE_WIDTH) / 2;
|
|
||||||
var plateHalfHeight = this.heatPlate.height / 2;
|
|
||||||
|
|
||||||
if(x < this.heatPlate.x - plateHalfWidth) {
|
|
||||||
return false;
|
|
||||||
} else if(this.heatPlate.x + plateHalfWidth < x) {
|
|
||||||
return false;
|
|
||||||
} else if(y < this.heatPlate.y - plateHalfHeight + Game.HEAT_PLATE_START_OFFSET_Y) {
|
|
||||||
return false;
|
|
||||||
} else if(this.heatPlate.y + plateHalfHeight + Game.HEAT_PLATE_START_OFFSET_Y - Game.HEAT_PLATE_HEIGHT< y) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isOverGod: function(x, y) {
|
isOverGod: function(x, y) {
|
||||||
// console.log("isOverGod : " + x + ", " + y + ", " + width + ", " + height);
|
return this.god.isOver(x, y);
|
||||||
|
|
||||||
var godHalfWidth = (this.god.width - Game.GOD_OUT_OF_FACE_WIDTH) / 2;
|
|
||||||
var godHalfHeight = this.god.height / 2;
|
|
||||||
if(x < this.god.x - godHalfWidth) {
|
|
||||||
return false;
|
|
||||||
} else if(this.god.x + godHalfWidth < x) {
|
|
||||||
return false;
|
|
||||||
} else if(y < this.god.y - this.god.height + Game.GOD_OUT_OF_FACE_HEIGHT) {
|
|
||||||
return false;
|
|
||||||
} else if(this.god.y - Game.GOD_OUT_OF_FACE_HEIGHT < y) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
godEatMeat: function(meat) {
|
godEatMeat: function(meat) {
|
||||||
@@ -308,11 +266,9 @@ var Game = {
|
|||||||
this.plusScoreGroup.add(tempPlusScore);
|
this.plusScoreGroup.add(tempPlusScore);
|
||||||
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
|
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
|
||||||
this.badMeatCount++;
|
this.badMeatCount++;
|
||||||
console.log("badMeatCount : " + this.badMeatCount);
|
|
||||||
|
|
||||||
this.god.animateAngryWithRare(meat);
|
this.god.animateAngryWithRare(meat);
|
||||||
|
|
||||||
// var score = this.getScore();
|
|
||||||
if(meat.getTotalCookingTime() > 0) {
|
if(meat.getTotalCookingTime() > 0) {
|
||||||
var score = meat.getScore();
|
var score = meat.getScore();
|
||||||
this.scoreManager.plusScore(score);
|
this.scoreManager.plusScore(score);
|
||||||
@@ -322,14 +278,13 @@ var Game = {
|
|||||||
}
|
}
|
||||||
} else { // meat is burn black
|
} else { // meat is burn black
|
||||||
this.badMeatCount++;
|
this.badMeatCount++;
|
||||||
console.log("badMeatCount : " + this.badMeatCount);
|
|
||||||
|
|
||||||
this.god.animateAngryWithBurnBlack(meat);
|
this.god.animateAngryWithBurnBlack(meat);
|
||||||
|
|
||||||
return; // god doesn't eat burned black meat
|
return; // god doesn't eat burned black meat
|
||||||
}
|
}
|
||||||
|
|
||||||
meat.setActive(false, -100, -100, '');
|
meat.setActive(false, -100, -100);
|
||||||
|
|
||||||
if(meatClassName == NormalMeat.CLASS_NAME) {
|
if(meatClassName == NormalMeat.CLASS_NAME) {
|
||||||
this.clearedMeatCount++;
|
this.clearedMeatCount++;
|
||||||
@@ -340,20 +295,7 @@ var Game = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
isOverTrashCan: function(x, y) {
|
isOverTrashCan: function(x, y) {
|
||||||
var trashCanHalfWidth = this.trashCan.width / 2;
|
return this.trashCan.isOver(x, y);
|
||||||
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) {
|
throwAway: function(meat) {
|
||||||
@@ -361,10 +303,9 @@ var Game = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this.badMeatCount++;
|
this.badMeatCount++;
|
||||||
console.log("badMeatCount : " + this.badMeatCount);
|
|
||||||
|
|
||||||
this.trashCan.animateAngry();
|
this.trashCan.animateAngry();
|
||||||
meat.setActive(false, -100, -100, '');
|
meat.setActive(false, -100, -100);
|
||||||
|
|
||||||
var score = meat.getScore();
|
var score = meat.getScore();
|
||||||
this.scoreManager.plusScore(score);
|
this.scoreManager.plusScore(score);
|
||||||
@@ -381,8 +322,6 @@ var Game = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
clearStage: function() {
|
clearStage: function() {
|
||||||
// this.stageTimer.addBonusTime(this.getBonusTime());
|
|
||||||
|
|
||||||
this.playingStageNo++;
|
this.playingStageNo++;
|
||||||
|
|
||||||
var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startStage, this);
|
var startStageTimeEvent = game.time.events.add(Phaser.Timer.SECOND * 1, this.startStage, this);
|
||||||
@@ -391,12 +330,6 @@ var Game = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
animateTextAlpha: function(targetText, startAlpha, endAlpha, msTime, effectType) {
|
|
||||||
targetText.alpha = startAlpha;
|
|
||||||
game.add.tween(targetText).to({alpha: endAlpha}, msTime, effectType, true);
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
timeOver: function() {
|
timeOver: function() {
|
||||||
var timeOverText = new TimeOverText();
|
var timeOverText = new TimeOverText();
|
||||||
if(!isExperienceMaestroAccount())
|
if(!isExperienceMaestroAccount())
|
||||||
@@ -436,18 +369,8 @@ var Game = {
|
|||||||
|
|
||||||
|
|
||||||
Game.GAME_TIME_SEC = 90;
|
Game.GAME_TIME_SEC = 90;
|
||||||
Game.NEXT_STAGE_DELAY_MS = 500;
|
|
||||||
|
|
||||||
Game.MAX_MEAT_COUNT = 20;
|
Game.MAX_MEAT_COUNT = 20;
|
||||||
|
|
||||||
Game.HEAT_PLATE_HANDLE_WIDTH = 440;
|
|
||||||
Game.HEAT_PLATE_START_OFFSET_Y = 80;
|
|
||||||
Game.HEAT_PLATE_HEIGHT = 220;
|
|
||||||
|
|
||||||
Game.GOD_OUT_OF_FACE_WIDTH = 30;
|
|
||||||
Game.GOD_OUT_OF_FACE_HEIGHT = 30;
|
|
||||||
|
|
||||||
Game.MEAT_PLATE_POSITION_X = 180;
|
Game.MEAT_PLATE_POSITION_X = 180;
|
||||||
Game.MEAT_PLATE_POSITION_Y = 390;
|
Game.MEAT_PLATE_POSITION_Y = 390;
|
||||||
|
|
||||||
Game.HEAT_PLATE_POSITION_Y = GAME_SCREEN_SIZE.y / 2 + 200;
|
|
||||||
@@ -83,19 +83,12 @@ God.prototype.makeParticles = function() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.update = function() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
God.prototype.onDown = function(sprite, pointer) {
|
God.prototype.onDown = function(sprite, pointer) {
|
||||||
console.log("onDown : " + pointer.x + ", " + pointer.y);
|
console.log("onDown : " + pointer.x + ", " + pointer.y);
|
||||||
this.animateAngry();
|
this.animateAngry();
|
||||||
}
|
}
|
||||||
|
|
||||||
God.prototype.isInRect = function(x, y) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
God.prototype.onDragStop = function(sprite, pointer) {
|
God.prototype.onDragStop = function(sprite, pointer) {
|
||||||
console.log("onDragStop : " + pointer.x + ", " + pointer.y);
|
console.log("onDragStop : " + pointer.x + ", " + pointer.y);
|
||||||
}
|
}
|
||||||
@@ -105,6 +98,21 @@ God.prototype.setScale = function(size) {
|
|||||||
this.backupScale = size;
|
this.backupScale = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
God.prototype.isOver = function(x, y) {
|
||||||
|
var halfWidth = (this.width - God.OUT_OF_FACE_WIDTH) / 2;
|
||||||
|
var halfHeight = this.height / 2;
|
||||||
|
if(x < this.x - halfWidth)
|
||||||
|
return false;
|
||||||
|
else if(this.x + halfWidth < x)
|
||||||
|
return false;
|
||||||
|
else if(y < this.y - this.height + God.OUT_OF_FACE_HEIGHT)
|
||||||
|
return false;
|
||||||
|
else if(this.y - God.OUT_OF_FACE_HEIGHT < y)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
God.prototype.animateHappy = function(meat) {
|
God.prototype.animateHappy = function(meat) {
|
||||||
this.speechBubble.showSpeechBubble(meat);
|
this.speechBubble.showSpeechBubble(meat);
|
||||||
@@ -184,6 +192,10 @@ God.POSITION_Y = 340;
|
|||||||
God.HEAD_WIDTH = 80;
|
God.HEAD_WIDTH = 80;
|
||||||
God.HEAD_HEIGHT = 30;
|
God.HEAD_HEIGHT = 30;
|
||||||
|
|
||||||
|
God.OUT_OF_FACE_WIDTH = 30;
|
||||||
|
God.OUT_OF_FACE_HEIGHT = 30;
|
||||||
|
|
||||||
|
|
||||||
God.EFFECT_LIFE_TIME_MS = 1200;
|
God.EFFECT_LIFE_TIME_MS = 1200;
|
||||||
|
|
||||||
God.REACTION_HAPPY = 0;
|
God.REACTION_HAPPY = 0;
|
||||||
|
|||||||
@@ -4,16 +4,12 @@ HeatPlate.prototype.constructor = HeatPlate;
|
|||||||
function HeatPlate() {
|
function HeatPlate() {
|
||||||
Phaser.Sprite.call(this, game, HeatPlate.POSITION_X, HeatPlate.POSITION_Y, 'heat_plate');
|
Phaser.Sprite.call(this, game, HeatPlate.POSITION_X, HeatPlate.POSITION_Y, 'heat_plate');
|
||||||
this.anchor.set(0.5);
|
this.anchor.set(0.5);
|
||||||
// this.scale.set(0.5);
|
|
||||||
this.smoothed = false;
|
this.smoothed = false;
|
||||||
this.inputEnabled = false;
|
this.inputEnabled = false;
|
||||||
game.add.existing(this);
|
game.add.existing(this);
|
||||||
|
|
||||||
// add 3 sprites for flame
|
|
||||||
// this.spriteFlame = game.make.sprite(0, 0, "flame_weak");
|
|
||||||
this.spriteFlame = game.make.sprite(0, 0, "heat_plate_flame");
|
this.spriteFlame = game.make.sprite(0, 0, "heat_plate_flame");
|
||||||
this.spriteFlame.anchor.set(0.5, 0.65);
|
this.spriteFlame.anchor.set(0.5, 0.65);
|
||||||
// this.spriteFlame.scale.set(0.5);
|
|
||||||
this.spriteFlame.smoothed = false;
|
this.spriteFlame.smoothed = false;
|
||||||
this.spriteFlame.alpha = 0.3;
|
this.spriteFlame.alpha = 0.3;
|
||||||
|
|
||||||
@@ -45,10 +41,33 @@ HeatPlate.prototype.onChangeDialLevel = function(dialLevel) {
|
|||||||
this.setBurnLevel(dialLevel);
|
this.setBurnLevel(dialLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeatPlate.prototype.isOver = function(x, y) {
|
||||||
|
var halfWidth = (this.width - HeatPlate.HANDLE_WIDTH) / 2;
|
||||||
|
var halfHeight = this.height / 2;
|
||||||
|
|
||||||
|
if(x < this.x - halfWidth) {
|
||||||
|
return false;
|
||||||
|
} else if(this.x + halfWidth < x) {
|
||||||
|
return false;
|
||||||
|
} else if(y < this.y - halfHeight + HeatPlate.START_OFFSET_Y) {
|
||||||
|
return false;
|
||||||
|
} else if(this.y + halfHeight + HeatPlate.START_OFFSET_Y - HeatPlate.HEIGHT < y) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HeatPlate.POSITION_X = GAME_SCREEN_SIZE.x / 2 + 70;
|
HeatPlate.POSITION_X = GAME_SCREEN_SIZE.x / 2 + 70;
|
||||||
HeatPlate.POSITION_Y = GAME_SCREEN_SIZE.y / 2 + 200;
|
HeatPlate.POSITION_Y = GAME_SCREEN_SIZE.y / 2 + 200;
|
||||||
|
|
||||||
|
HeatPlate.HANDLE_WIDTH = 440;
|
||||||
|
HeatPlate.START_OFFSET_Y = 80;
|
||||||
|
HeatPlate.HEIGHT = 220;
|
||||||
|
|
||||||
|
|
||||||
HeatPlate.BURN_LEVEL_WEAK = 0;
|
HeatPlate.BURN_LEVEL_WEAK = 0;
|
||||||
HeatPlate.BURN_LEVEL_NORMAL = 1;
|
HeatPlate.BURN_LEVEL_NORMAL = 1;
|
||||||
HeatPlate.BURN_LEVEL_STRONG = 2;
|
HeatPlate.BURN_LEVEL_STRONG = 2;
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ MeatBase.prototype.getMeatGradeBySide = function(cookingSide) {
|
|||||||
return this.cookingGrade[cookingSide];
|
return this.cookingGrade[cookingSide];
|
||||||
}
|
}
|
||||||
|
|
||||||
MeatBase.prototype.setActive = function(isActivated, x, y, meat_type) {
|
MeatBase.prototype.setActive = function(isActivated, x, y) {
|
||||||
this.isActivated = isActivated;
|
this.isActivated = isActivated;
|
||||||
|
|
||||||
if(isActivated == false) {
|
if(isActivated == false) {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ function SpeechBubble() {
|
|||||||
this.inputEnabled = false;
|
this.inputEnabled = false;
|
||||||
game.add.existing(this);
|
game.add.existing(this);
|
||||||
|
|
||||||
// this.speechBubbleText = game.add.text(-451 / 2, -227 / 2, "맛없어!!!", textStyle);
|
|
||||||
this.speechBubbleText = game.add.text(0, 0, "", textStyle);
|
this.speechBubbleText = game.add.text(0, 0, "", textStyle);
|
||||||
this.speechBubbleText.addColor("#f00", 0);
|
this.speechBubbleText.addColor("#f00", 0);
|
||||||
this.speechBubbleText.anchor.setTo(0.5);
|
this.speechBubbleText.anchor.setTo(0.5);
|
||||||
|
|||||||
@@ -4,26 +4,38 @@ TrashCan.prototype.constructor = TrashCan;
|
|||||||
function TrashCan() {
|
function TrashCan() {
|
||||||
Phaser.Sprite.call(this, game, TrashCan.POSITION_X, TrashCan.POSITION_Y, 'trash_can');
|
Phaser.Sprite.call(this, game, TrashCan.POSITION_X, TrashCan.POSITION_Y, 'trash_can');
|
||||||
this.anchor.set(0.5, 1);
|
this.anchor.set(0.5, 1);
|
||||||
// this.scale.set(1);
|
this.scale.set(1);
|
||||||
this.smoothed = false;
|
this.smoothed = false;
|
||||||
this.inputEnabled = false;
|
this.inputEnabled = false;
|
||||||
game.add.existing(this);
|
game.add.existing(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TrashCan.prototype.isOver = function(x, y) {
|
||||||
|
var halfWidth = this.width / 2;
|
||||||
|
var halfHeight = this.height;
|
||||||
|
|
||||||
|
if(x < this.x - halfWidth) return false;
|
||||||
|
else if(this.x + halfWidth < x) return false;
|
||||||
|
else if(y < this.y - this.height) return false;
|
||||||
|
else if(this.y < y) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
TrashCan.prototype.animateAngry = function(meat) {
|
TrashCan.prototype.animateAngry = function(meat) {
|
||||||
var tween = game.add.tween(this.scale);
|
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: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.Elastic.InOut, true, 0, 2, true);
|
||||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||||
tween.onComplete.add(this.smileAgain, this);
|
tween.onComplete.add(this.resetScale, this);
|
||||||
tween.start();
|
tween.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
TrashCan.prototype.smileAgain = function() {
|
TrashCan.prototype.resetScale = function() {
|
||||||
this.scale.set(1);
|
this.scale.set(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TrashCan.POSITION_X = God.POSITION_X - 200;
|
TrashCan.POSITION_X = God.POSITION_X - 200;
|
||||||
TrashCan.POSITION_Y = God.POSITION_Y + 60;
|
TrashCan.POSITION_Y = God.POSITION_Y + 60;
|
||||||
@@ -25,7 +25,7 @@ Waiter.prototype.animateServing = function() {
|
|||||||
this.x = Waiter.POSITION_X;
|
this.x = Waiter.POSITION_X;
|
||||||
this.show();
|
this.show();
|
||||||
var tween = game.add.tween(this);
|
var tween = game.add.tween(this);
|
||||||
tween.to({x:200}, 500, Phaser.Easing.Linear.In, true, 0);
|
tween.to({x:200}, 300, Phaser.Easing.Linear.In, 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.Elastic.InOut, true, 0, 2, true);
|
||||||
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
|
||||||
// tween.onComplete.add(this.smileAgain, this);
|
// tween.onComplete.add(this.smileAgain, this);
|
||||||
@@ -49,5 +49,5 @@ Waiter.prototype.show = function() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Waiter.POSITION_X = -150;
|
Waiter.POSITION_X = -150;
|
||||||
Waiter.POSITION_Y = 340;
|
Waiter.POSITION_Y = 340;
|
||||||
Reference in New Issue
Block a user