Fix: speech bubble
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user