Add: waiter

This commit is contained in:
2019-12-10 20:56:28 +09:00
parent f1c4d918a8
commit ad229189c9
2 changed files with 16 additions and 13 deletions
+5 -2
View File
@@ -64,6 +64,10 @@ var Game = {
this.plusScoreGroup = game.add.group(); this.plusScoreGroup = game.add.group();
var table = game.add.tileSprite(0, 340, GAME_SCREEN_SIZE.x, 660, 'wooden_table'); var table = game.add.tileSprite(0, 340, GAME_SCREEN_SIZE.x, 660, 'wooden_table');
this.god = new God(this);
this.waiter = new Waiter();
this.meatPlate = game.add.image(220, Game.MEAT_PLATE_POSITION_Y, 'plate'); this.meatPlate = game.add.image(220, Game.MEAT_PLATE_POSITION_Y, 'plate');
this.meatPlate.anchor.set(0.5); this.meatPlate.anchor.set(0.5);
this.meatPlate.smoothed = false; this.meatPlate.smoothed = false;
@@ -76,8 +80,6 @@ var Game = {
this.trashCan = new TrashCan(); this.trashCan = new TrashCan();
this.god = new God(this);
// meat // meat
this.bonusMeat = new BonusMeat(this); this.bonusMeat = new BonusMeat(this);
this.bonusMeat.setActive(false, -100, -100, ""); this.bonusMeat.setActive(false, -100, -100, "");
@@ -195,6 +197,7 @@ var Game = {
console.log("badMeatCount : " + this.badMeatCount); console.log("badMeatCount : " + this.badMeatCount);
this.activatedMeatCount = this.getStageMeatCount(); this.activatedMeatCount = this.getStageMeatCount();
this.serveMeats(); this.serveMeats();
this.waiter.animateServing();
}, },
setClickEnable: function(value) { setClickEnable: function(value) {
+11 -11
View File
@@ -7,28 +7,28 @@ function Waiter() {
Phaser.Sprite.call(this, game, Waiter.POSITION_X, Waiter.POSITION_Y, 'waiter'); Phaser.Sprite.call(this, game, Waiter.POSITION_X, Waiter.POSITION_Y, 'waiter');
this.anchor.setTo(0.5, 1); this.anchor.setTo(0.5, 1);
this.scale.set(0.5); this.scale.set(0.5);
this.x = Waiter.POSITION_X;
this.inputEnabled = false; this.inputEnabled = false;
// this.input.enableDrag(false);
// this.events.onInputDown.add(this.onDown, this);
game.add.existing(this); game.add.existing(this);
this.speechBubble = new SpeechBubble(); this.speechBubble = new SpeechBubble();
this.speechBubble.x = 400;
this.speechBubble.y = 150;
this.speechBubble.setupWaiterSpeechBubble(); this.speechBubble.setupWaiterSpeechBubble();
this.speechBubble.hideSpeechBubble(); this.speechBubble.hide();
} }
Waiter.prototype.animateServing = function() { Waiter.prototype.animateServing = function() {
this.speechBubble.show(); this.speechBubble.show();
this.x = Waiter.POSITION_X;
this.show(); this.show();
var tween = game.add.tween(this.x); var tween = game.add.tween(this);
tween.to(200, 500, Phaser.Easing.Quadratic.Out, true, 0); tween.to({x:200}, 500, 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);
tween.start(); tween.start();
@@ -38,16 +38,16 @@ Waiter.prototype.animateServing = function() {
Waiter.prototype.hide = function() { Waiter.prototype.hide = function() {
this.alpha = 0; this.alpha = 0;
this.x = -100; this.speechBubble.hide();
} }
Waiter.prototype.show = function() { Waiter.prototype.show = function() {
this.x = -100;
this.alpha = 1; this.alpha = 1;
this.speechBubble.show();
} }
Waiter.POSITION_X = GAME_SCREEN_SIZE.x - 120; Waiter.POSITION_X = -150;
Waiter.POSITION_Y = 340; Waiter.POSITION_Y = 340;