Fix: speech bubble
This commit is contained in:
@@ -73,14 +73,14 @@ var Game = {
|
||||
this.meatPlate.scale.set(0.8);
|
||||
this.meatPlate.smoothed = false;
|
||||
|
||||
this.trashCan = new TrashCan();
|
||||
|
||||
this.heatPlate = new HeatPlate();
|
||||
this.stoveDial = new StoveDial(80, HeatPlate.POSITION_Y + 70);
|
||||
this.stoveDial = new StoveDial(180, HeatPlate.POSITION_Y + 90);
|
||||
this.stoveDial.setOnChangeDialLevelHandler(
|
||||
(function(dialLevel) { this.onChangeDialLevel(dialLevel); }).bind(this)
|
||||
);
|
||||
|
||||
this.trashCan = new TrashCan();
|
||||
|
||||
// meat
|
||||
this.bonusMeatIndex = 0;
|
||||
this.bonusMeatGroup = game.add.group();
|
||||
@@ -263,7 +263,6 @@ var Game = {
|
||||
},
|
||||
|
||||
|
||||
|
||||
isOverHeatPlate: function(x, y) {
|
||||
return this.heatPlate.isOver(x, y);
|
||||
},
|
||||
@@ -276,10 +275,8 @@ var Game = {
|
||||
if(!this.isPlaying)
|
||||
return;
|
||||
|
||||
var meatClassName = meat.getClassName();
|
||||
|
||||
if(meat.getMeatGrade() == MeatBase.DONENESS_WELLDONE) {
|
||||
this.god.animateHappy(meat);
|
||||
this.god.animateHappy();
|
||||
|
||||
var score = meat.getScore();
|
||||
this.scoreManager.plusScore(score);
|
||||
@@ -289,7 +286,10 @@ var Game = {
|
||||
} else if(meat.getMeatGrade() == MeatBase.DONENESS_RARE) {
|
||||
this.badMeatCount++;
|
||||
|
||||
this.god.animateAngryWithRare(meat);
|
||||
if(meat.getTotalCookingTime() == 0)
|
||||
this.god.animateAngryWithRare();
|
||||
else
|
||||
this.god.animateSmile();
|
||||
|
||||
if(meat.getTotalCookingTime() > 0) {
|
||||
var score = meat.getScore();
|
||||
@@ -301,14 +301,14 @@ var Game = {
|
||||
} else { // meat is burn black
|
||||
this.badMeatCount++;
|
||||
|
||||
this.god.animateAngryWithBurnBlack(meat);
|
||||
this.god.animateAngryWithBurnBlack();
|
||||
|
||||
return; // god doesn't eat burned black meat
|
||||
}
|
||||
|
||||
meat.setActive(false, -100, -100);
|
||||
|
||||
if(meatClassName == NormalMeat.CLASS_NAME) {
|
||||
if(meat.getClassName() == NormalMeat.CLASS_NAME) {
|
||||
this.clearedMeatCount++;
|
||||
if(this.clearedMeatCount == this.activatedMeatCount) {
|
||||
this.clearStage();
|
||||
@@ -320,7 +320,7 @@ var Game = {
|
||||
return this.trashCan.isOver(x, y);
|
||||
},
|
||||
|
||||
throwAway: function(meat) {
|
||||
throwAwayMeat: function(meat) {
|
||||
if(!this.isPlaying)
|
||||
return;
|
||||
|
||||
@@ -361,6 +361,7 @@ var Game = {
|
||||
var timeOverText = new TimeOverText();
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
|
||||
this.stopAndGoResult();
|
||||
},
|
||||
|
||||
|
||||
@@ -3,16 +3,11 @@ God.prototype.constructor = God;
|
||||
|
||||
function God(mainGame) {
|
||||
this.mainGame = mainGame;
|
||||
this.isActivated = true;
|
||||
|
||||
Phaser.Sprite.call(this, game, God.POSITION_X, God.POSITION_Y, 'god_angry');
|
||||
Phaser.Sprite.call(this, game, God.POSITION_X, God.POSITION_Y, 'god_smile');
|
||||
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();
|
||||
@@ -25,33 +20,20 @@ function God(mainGame) {
|
||||
God.prototype.makeParticles = function() {
|
||||
game.physics.startSystem(Phaser.Physics.ARCADE);
|
||||
|
||||
// full heart
|
||||
this.fullHeartEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 170, 20);
|
||||
this.fullHeartEmitter.makeParticles("heart_full");
|
||||
// this.fullHeartEmitter.minParticleScale = 0.5;
|
||||
// this.fullHeartEmitter.maxParticleScale = 0.7;
|
||||
// this.fullHeartEmitter.minParticleSpeed.setTo(-150, -700);
|
||||
// this.fullHeartEmitter.maxParticleSpeed.setTo(150, -500);
|
||||
// this.fullHeartEmitter.gravity = 1500;
|
||||
this.fullHeartEmitter.minParticleScale = 0.5;
|
||||
this.fullHeartEmitter.maxParticleScale = 0.7;
|
||||
this.fullHeartEmitter.minParticleSpeed.setTo(-150, -700);
|
||||
this.fullHeartEmitter.maxParticleSpeed.setTo(150, -500);
|
||||
this.fullHeartEmitter.gravity = 1500;
|
||||
this.fullHeartEmitter.width = God.HEAD_WIDTH;
|
||||
this.fullHeartEmitter.height = God.HEAD_HEIGHT;
|
||||
this.fullHeartEmitter.setRotation(-180, 180);
|
||||
// this.fullHeartEmitter.setAlpha(0.1, 0.3);
|
||||
// this.fullHeartEmitter.setScale(0.2, 0.2);
|
||||
// this.fullHeartEmitter.minParticleScale = 0.4;
|
||||
// this.fullHeartEmitter.maxParticleScale = 0.5;
|
||||
this.fullHeartEmitter.minParticleSpeed.setTo(-10, -200);
|
||||
this.fullHeartEmitter.maxParticleSpeed.setTo(10, -100);
|
||||
// this.fullHeartEmitter.gravity = 3000;
|
||||
this.fullHeartEmitter.setAlpha(
|
||||
1.0, 0.0,
|
||||
God.EFFECT_LIFE_TIME_MS, Phaser.Easing.Bounce.In, false
|
||||
);
|
||||
this.fullHeartEmitter.setScale(
|
||||
0.4, 0.6, 0.4, 0.6,
|
||||
God.EFFECT_LIFE_TIME_MS, Phaser.Easing.Quadratic.Out, false
|
||||
);
|
||||
|
||||
this.emptyHeartEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 150, 20);
|
||||
// empty heart
|
||||
this.emptyHeartEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 150, 10);
|
||||
this.emptyHeartEmitter.makeParticles("heart_empty");
|
||||
this.emptyHeartEmitter.minParticleScale = 0.5;
|
||||
this.emptyHeartEmitter.maxParticleScale = 0.7;
|
||||
@@ -59,6 +41,7 @@ God.prototype.makeParticles = function() {
|
||||
this.emptyHeartEmitter.maxParticleSpeed.setTo(150, -500);
|
||||
this.emptyHeartEmitter.gravity = 1500;
|
||||
|
||||
// angry
|
||||
this.angryEmitter = game.add.emitter(God.POSITION_X, God.POSITION_Y - 200, 20);
|
||||
this.angryEmitter.makeParticles("smoke");
|
||||
this.angryEmitter.width = God.HEAD_WIDTH;
|
||||
@@ -68,36 +51,12 @@ God.prototype.makeParticles = function() {
|
||||
0.2, 0.0,
|
||||
God.EFFECT_LIFE_TIME_MS, Phaser.Easing.Bounce.In, false
|
||||
);
|
||||
// this.angryEmitter.setAlpha(0.1, 0.3);
|
||||
// this.angryEmitter.setScale(0.2, 0.2);
|
||||
this.angryEmitter.minParticleScale = 0.5;
|
||||
this.angryEmitter.maxParticleScale = 1;
|
||||
this.angryEmitter.gravity = -300;
|
||||
|
||||
|
||||
this.angryEmitter.forEach(
|
||||
function(particle) {
|
||||
// particle.tint = 0xf0f0f0;
|
||||
particle.tint = 0xa08080;
|
||||
}
|
||||
);
|
||||
this.angryEmitter.gravity = -1000;
|
||||
}
|
||||
|
||||
|
||||
God.prototype.onDown = function(sprite, pointer) {
|
||||
console.log("onDown : " + pointer.x + ", " + pointer.y);
|
||||
this.animateAngry();
|
||||
}
|
||||
|
||||
God.prototype.onDragStop = function(sprite, pointer) {
|
||||
console.log("onDragStop : " + pointer.x + ", " + pointer.y);
|
||||
}
|
||||
|
||||
God.prototype.setScale = function(size) {
|
||||
this.scale.set(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;
|
||||
@@ -114,47 +73,48 @@ God.prototype.isOver = function(x, y) {
|
||||
}
|
||||
|
||||
|
||||
God.prototype.animateHappy = function(meat) {
|
||||
this.speechBubble.showSpeechBubble(meat);
|
||||
God.prototype.animateHappy = function() {
|
||||
this.speechBubble.animateRoundSpeech(God.SPEECH_X, God.SPEECH_Y, "맛있어. ^o^");
|
||||
this.particleBurst(God.REACTION_WELLDONE);
|
||||
|
||||
this.loadTexture('god_happy');
|
||||
var tween = game.add.tween(this.scale);
|
||||
tween.to({x:0.7, y:0.7}, 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();
|
||||
|
||||
this.particleBurst(God.REACTION_HAPPY);
|
||||
}
|
||||
|
||||
God.prototype.animateAngryWithRare = function(meat) {
|
||||
this.speechBubble.showSpeechBubble(meat);
|
||||
God.prototype.animateSmile = function() {
|
||||
this.speechBubble.animateRectSpeech(God.SPEECH_X, God.SPEECH_Y, "좀 질기네. -_-");
|
||||
this.particleBurst(God.REACTION_MEDIUM);
|
||||
|
||||
this.loadTexture('god_smile');
|
||||
var tween = game.add.tween(this.scale);
|
||||
tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Bounce.Out, true, 0);
|
||||
tween.onComplete.add(this.smileAgain, this);
|
||||
tween.start();
|
||||
}
|
||||
|
||||
God.prototype.animateAngryWithRare = function() {
|
||||
this.speechBubble.animateStarSpeech(God.SPEECH_X, God.SPEECH_Y, "날고기 싫어!!!");
|
||||
this.particleBurst(God.REACTION_RARE);
|
||||
|
||||
this.loadTexture('god_angry');
|
||||
var tween = game.add.tween(this.scale);
|
||||
tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Bounce.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();
|
||||
|
||||
if(meat.getTotalCookingTime() == 0)
|
||||
this.particleBurst(God.REACTION_ANGRY);
|
||||
}
|
||||
|
||||
God.prototype.animateAngryWithBurnBlack = function(meat) {
|
||||
this.speechBubble.showSpeechBubble(meat);
|
||||
God.prototype.animateAngryWithBurnBlack = function() {
|
||||
this.speechBubble.animateDoubleStarSpeech(God.SPEECH_X, God.SPEECH_Y, "탄고기\n안먹어!!!");
|
||||
this.particleBurst(God.REACTION_BURN_BLACK);
|
||||
|
||||
this.loadTexture('god_angry');
|
||||
var tween = game.add.tween(this.scale);
|
||||
tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Bounce.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();
|
||||
|
||||
this.particleBurst(God.REACTION_ANGRY);
|
||||
}
|
||||
|
||||
God.prototype.smileAgain = function() {
|
||||
@@ -171,15 +131,21 @@ God.prototype.particleBurst = function(reaction) {
|
||||
// this.emptyHeartEmitter.on = false;
|
||||
|
||||
switch(reaction) {
|
||||
case God.REACTION_HAPPY:
|
||||
case God.REACTION_WELLDONE:
|
||||
this.fullHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 10, true);
|
||||
break;
|
||||
|
||||
case God.REACTION_SMILE:
|
||||
this.emptyHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 15, true);
|
||||
case God.REACTION_MEDIUM:
|
||||
this.emptyHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS / 2, 100, 15, true);
|
||||
break;
|
||||
|
||||
case God.REACTION_ANGRY:
|
||||
case God.REACTION_RARE:
|
||||
this.angryEmitter.forEach( function(particle) { particle.tint = 0xff6060; } );
|
||||
this.angryEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 20, true);
|
||||
break;
|
||||
|
||||
case God.REACTION_BURN_BLACK:
|
||||
this.angryEmitter.forEach( function(particle) { particle.tint = 0x000000; } );
|
||||
this.angryEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 20, true);
|
||||
break;
|
||||
}
|
||||
@@ -189,15 +155,18 @@ God.prototype.particleBurst = function(reaction) {
|
||||
God.POSITION_X = GAME_SCREEN_SIZE.x - 120;
|
||||
God.POSITION_Y = 340;
|
||||
|
||||
God.HEAD_WIDTH = 80;
|
||||
God.HEAD_WIDTH = 120;
|
||||
God.HEAD_HEIGHT = 30;
|
||||
|
||||
God.OUT_OF_FACE_WIDTH = 30;
|
||||
God.OUT_OF_FACE_HEIGHT = 30;
|
||||
|
||||
|
||||
God.EFFECT_LIFE_TIME_MS = 1200;
|
||||
|
||||
God.REACTION_HAPPY = 0;
|
||||
God.REACTION_SMILE = 1;
|
||||
God.REACTION_ANGRY = 2;
|
||||
God.REACTION_WELLDONE = 0;
|
||||
God.REACTION_MEDIUM = 1;
|
||||
God.REACTION_RARE = 2;
|
||||
God.REACTION_BURN_BLACK = 3;
|
||||
|
||||
God.SPEECH_X = God.POSITION_X - 200;
|
||||
God.SPEECH_Y = God.POSITION_Y - 200;
|
||||
@@ -61,7 +61,7 @@ HeatPlate.prototype.isOver = function(x, y) {
|
||||
|
||||
|
||||
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 + 180;
|
||||
|
||||
HeatPlate.HANDLE_WIDTH = 440;
|
||||
HeatPlate.START_OFFSET_Y = 80;
|
||||
|
||||
@@ -158,7 +158,7 @@ MeatBase.prototype.onDragStopListener = function(pointer) {
|
||||
// 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);
|
||||
this.mainGame.throwAwayMeat(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,12 +175,17 @@ MeatBase.prototype.getTotalCookingTime = function() {
|
||||
MeatBase.prototype.getScore = function() {
|
||||
var meatDoneness = this.getMeatGrade();
|
||||
var scoreDoneness = this.scoreArray[meatDoneness];
|
||||
// console.log("meatDoneness : " + meatDoneness);
|
||||
// console.log("this.scoreArray : " + this.scoreArray);
|
||||
// console.log("scoreDoneness : " + scoreDoneness);
|
||||
|
||||
if(meatDoneness == MeatBase.DONENESS_BURN_BLACK)
|
||||
return scoreDoneness;
|
||||
|
||||
var totalCookingTime = this.getTotalCookingTime();
|
||||
return Math.floor(scoreDoneness * totalCookingTime);
|
||||
var totalScore = Math.floor(scoreDoneness * totalCookingTime);
|
||||
// console.log("totalScore : " + totalScore);
|
||||
return totalScore;
|
||||
}
|
||||
|
||||
MeatBase.prototype.isFront = function() {
|
||||
@@ -288,10 +293,10 @@ MeatBase.prototype.setActive = function(isActivated, x, y) {
|
||||
}
|
||||
|
||||
this.cookingSide = MeatBase.MEAT_NONE;
|
||||
this.cookingTimeBySide[MeatBase.MEAT_BACK] = 0;
|
||||
this.cookingTimeBySide[MeatBase.MEAT_FRONT] = 0;
|
||||
this.cookingGradeBySide[MeatBase.MEAT_BACK] = MeatBase.DONENESS_RARE;
|
||||
this.cookingGradeBySide[MeatBase.MEAT_FRONT] = MeatBase.DONENESS_RARE;
|
||||
this.cookingTimeBySide[MeatBase.MEAT_BACK] = 0;
|
||||
this.cookingTimeBySide[MeatBase.MEAT_FRONT] = 0;
|
||||
this.cookingGradeBySide[MeatBase.MEAT_BACK] = MeatBase.DONENESS_RARE;
|
||||
this.cookingGradeBySide[MeatBase.MEAT_FRONT] = MeatBase.DONENESS_RARE;
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -16,7 +16,7 @@ NormalMeat.prototype.setNormalMeatTypeVariables = function() {
|
||||
this.cookingTimeForGradeArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.COOKING_TIME_WELLDONE;
|
||||
this.cookingTimeForGradeArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.COOKING_TIME_BURN_BLACK;
|
||||
|
||||
this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_NAME_RARE;
|
||||
this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_RARE;
|
||||
this.scoreArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.SCORE_WELLDONE;
|
||||
this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.SCORE_BURN_BLACK;
|
||||
}
|
||||
|
||||
@@ -2,70 +2,143 @@ SpeechBubble.prototype = Object.create(Phaser.Sprite.prototype);
|
||||
SpeechBubble.prototype.constructor = SpeechBubble;
|
||||
|
||||
function SpeechBubble() {
|
||||
var textStyle = { font: "normal 24px Arial", fill: "#ff0", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
var textStyle = { font: "normal 24px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
|
||||
Phaser.Sprite.call(this, game, SpeechBubble.POSITION_X, SpeechBubble.POSITION_Y, 'speech_bubble_angry');
|
||||
Phaser.Sprite.call(this, game, SpeechBubble.POSITION_X, SpeechBubble.POSITION_Y, '');
|
||||
this.anchor.set(0.5);
|
||||
this.scale.set(0.7);
|
||||
this.inputEnabled = false;
|
||||
game.add.existing(this);
|
||||
|
||||
this.bgSprite = game.add.sprite(0, 0, '');
|
||||
this.bgSprite.anchor.set(0.5);
|
||||
this.addChild(this.bgSprite);
|
||||
|
||||
this.shadowSprite = game.add.sprite(0, 0, '');
|
||||
this.shadowSprite.anchor.set(0.5);
|
||||
this.addChild(this.shadowSprite);
|
||||
|
||||
this.outlineSprite = game.add.sprite(0, 0, '');
|
||||
this.outlineSprite.anchor.set(0.5);
|
||||
this.addChild(this.outlineSprite);
|
||||
|
||||
this.speechBubbleText = game.add.text(0, 0, "", textStyle);
|
||||
this.speechBubbleText.addColor("#f00", 0);
|
||||
this.speechBubbleText.anchor.setTo(0.5);
|
||||
this.speechBubbleText.scale.set(1.7);
|
||||
this.speechBubbleText.scale.set(1.3);
|
||||
this.addChild(this.speechBubbleText);
|
||||
}
|
||||
|
||||
|
||||
SpeechBubble.prototype.showSpeechBubble = function(meat) {
|
||||
var meatDoneness = meat.getMeatGrade();
|
||||
switch(meatDoneness) {
|
||||
case Meat.DONENESS_WELLDONE:
|
||||
this.speechBubbleText.addColor("#33f", 0);
|
||||
this.loadTexture('speech_bubble_happy');
|
||||
this.speechBubbleText.text = "맛있어 ♥♡♥";
|
||||
break;
|
||||
|
||||
case Meat.DONENESS_RARE:
|
||||
if(meat.getTotalCookingTime() == 0) {
|
||||
this.speechBubbleText.addColor("#f33", 0);
|
||||
this.loadTexture('speech_bubble_angry');
|
||||
this.speechBubbleText.text = "하나도\n안익혔짆아!!!";
|
||||
} else {
|
||||
this.speechBubbleText.addColor("#33f", 0);
|
||||
this.loadTexture('speech_bubble_happy');
|
||||
this.speechBubbleText.text = "덜 익었어!!!";
|
||||
}
|
||||
break;
|
||||
SpeechBubble.prototype.flipHorizontal = function(color) {
|
||||
this.bgSprite.scale.x *= -1;
|
||||
this.shadowSprite.scale.x *= -1;
|
||||
this.outlineSprite.scale.x *= -1;
|
||||
}
|
||||
|
||||
case Meat.DONENESS_BURN_BLACK:
|
||||
this.speechBubbleText.addColor("#333", 0);
|
||||
this.loadTexture('speech_bubble_angry');
|
||||
this.speechBubbleText.text = "탄 고기\n안먹을래!!!";
|
||||
break;
|
||||
SpeechBubble.prototype.setBgColor = function(color) {
|
||||
this.bgSprite.tint = color;
|
||||
}
|
||||
|
||||
}
|
||||
SpeechBubble.prototype.setShadowColor = function(color) {
|
||||
this.shadowSprite.tint = color;
|
||||
}
|
||||
|
||||
this.alpha = 1;
|
||||
this.scale.set(0.6);
|
||||
SpeechBubble.prototype.setOutlineColor = function(color) {
|
||||
this.outlineSprite.tint = color;
|
||||
}
|
||||
|
||||
this.startAnimation();
|
||||
SpeechBubble.prototype.setTextColor = function(color) {
|
||||
this.speechBubbleText.addColor(color, 0);
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.setText = function(content) {
|
||||
this.speechBubbleText.text = content;
|
||||
}
|
||||
|
||||
|
||||
SpeechBubble.prototype.setRoundSprite = function() {
|
||||
this.bgSprite.loadTexture("speech_round_bg");
|
||||
this.shadowSprite.loadTexture("speech_round_shadow");
|
||||
this.outlineSprite.loadTexture("speech_round_outline");
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.setRectSprite = function() {
|
||||
this.bgSprite.loadTexture("speech_rect_bg");
|
||||
this.shadowSprite.loadTexture("speech_rect_shadow");
|
||||
this.outlineSprite.loadTexture("speech_rect_outline");
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.setStarSprite = function() {
|
||||
this.bgSprite.loadTexture("speech_star_bg");
|
||||
this.shadowSprite.loadTexture("speech_star_shadow");
|
||||
this.outlineSprite.loadTexture("speech_star_outline");
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.setDoubleStarSprite = function() {
|
||||
this.bgSprite.loadTexture("speech_double_star_bg");
|
||||
this.shadowSprite.loadTexture("speech_double_star_shadow");
|
||||
this.outlineSprite.loadTexture("speech_double_star_outline");
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.move = function(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.startAnimation = function() {
|
||||
this.scale.set(0.7);
|
||||
this.show();
|
||||
|
||||
var tween = game.add.tween(this.scale);
|
||||
tween.to({x:0.7, y:0.7}, 200, Phaser.Easing.Linear.None, true, 0);
|
||||
tween.to({x:1, y:1}, 200, Phaser.Easing.Linear.None, true, 0);
|
||||
tween.start();
|
||||
|
||||
game.time.events.add(Phaser.Timer.SECOND * 1, this.hide, this);
|
||||
}
|
||||
|
||||
|
||||
SpeechBubble.prototype.setupWaiterSpeechBubble = function(meat) {
|
||||
this.speechBubbleText.addColor("#33f", 0);
|
||||
this.loadTexture('speech_bubble_happy');
|
||||
this.speechBubbleText.text = "맛있게 드세요!";
|
||||
SpeechBubble.prototype.animateRoundSpeech = function(x, y, text) {
|
||||
this.setRoundSprite();
|
||||
this.setBgColor(0xffffff);
|
||||
this.setShadowColor(0x00e0ff);
|
||||
this.setOutlineColor(0x0099ff);
|
||||
this.setTextColor("#0099ff");
|
||||
this.setText(text);
|
||||
this.move(x, y);
|
||||
this.startAnimation();
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.animateRectSpeech = function(x, y, text) {
|
||||
this.setRectSprite();
|
||||
this.setBgColor(0xffffff);
|
||||
this.setShadowColor(0xffdd00);
|
||||
this.setOutlineColor(0xff9900);
|
||||
this.setTextColor("#ff9900");
|
||||
this.setText(text);
|
||||
this.move(x, y);
|
||||
this.startAnimation();
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.animateStarSpeech = function(x, y, text) {
|
||||
this.setStarSprite();
|
||||
this.setBgColor(0xffffff);
|
||||
this.setShadowColor(0xff3000);
|
||||
this.setOutlineColor(0xff6600);
|
||||
this.setTextColor("#ff6600");
|
||||
this.setText(text);
|
||||
this.move(x, y);
|
||||
this.startAnimation();
|
||||
}
|
||||
|
||||
SpeechBubble.prototype.animateDoubleStarSpeech = function(x, y, text) {
|
||||
this.setDoubleStarSprite();
|
||||
this.setBgColor(0xffffff);
|
||||
this.setShadowColor(0xd00000);
|
||||
this.setOutlineColor(0xff0000);
|
||||
this.setTextColor("#ff0000");
|
||||
this.setText(text);
|
||||
this.move(x, y);
|
||||
this.startAnimation();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,3 +157,8 @@ SpeechBubble.prototype.destroySelf = function() {
|
||||
|
||||
SpeechBubble.POSITION_X = God.POSITION_X - 200;
|
||||
SpeechBubble.POSITION_Y = God.POSITION_Y - 200;
|
||||
|
||||
SpeechBubble.TYPE_ROUND = 0;
|
||||
SpeechBubble.TYPE_RECT = 1;
|
||||
SpeechBubble.TYPE_STAR = 2;
|
||||
SpeechBubble.TYPE_DOUBLE_STAR = 3;
|
||||
@@ -38,4 +38,4 @@ TrashCan.prototype.resetScale = function() {
|
||||
|
||||
|
||||
TrashCan.POSITION_X = God.POSITION_X - 200;
|
||||
TrashCan.POSITION_Y = God.POSITION_Y + 60;
|
||||
TrashCan.POSITION_Y = God.POSITION_Y + 50;
|
||||
@@ -12,26 +12,20 @@ function Waiter() {
|
||||
game.add.existing(this);
|
||||
|
||||
this.speechBubble = new SpeechBubble();
|
||||
this.speechBubble.x = 400;
|
||||
this.speechBubble.y = 150;
|
||||
this.speechBubble.setupWaiterSpeechBubble();
|
||||
this.speechBubble.flipHorizontal();
|
||||
this.speechBubble.hide();
|
||||
}
|
||||
|
||||
|
||||
Waiter.prototype.animateServing = function() {
|
||||
this.speechBubble.show();
|
||||
this.speechBubble.animateRoundSpeech(Waiter.SPEECH_X, Waiter.SPEECH_Y, "맛있게 드세요!");
|
||||
|
||||
this.x = Waiter.POSITION_X;
|
||||
this.show();
|
||||
var tween = game.add.tween(this);
|
||||
tween.to({x:200}, Waiter.SERVING_WAIT_TIME_MS, 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.Linear.None, true, 0);
|
||||
// tween.onComplete.add(this.smileAgain, this);
|
||||
tween.start();
|
||||
|
||||
|
||||
game.time.events.add(Phaser.Timer.SECOND * 1, this.hide, this);
|
||||
}
|
||||
|
||||
@@ -51,3 +45,6 @@ Waiter.POSITION_X = -150;
|
||||
Waiter.POSITION_Y = 340;
|
||||
|
||||
Waiter.SERVING_WAIT_TIME_MS = 300;
|
||||
|
||||
Waiter.SPEECH_X = Waiter.POSITION_X + 550;
|
||||
Waiter.SPEECH_Y = Waiter.POSITION_Y - 190;
|
||||
Reference in New Issue
Block a user