Fix: god's particle effect

This commit is contained in:
2019-12-07 23:58:44 +09:00
parent 86b7ca3f06
commit 1dc49cfb94
+43 -13
View File
@@ -22,13 +22,31 @@ function God(x, y, mainGame) {
God.prototype.makeParticles = function(x, y) {
game.physics.startSystem(Phaser.Physics.ARCADE);
this.fullHeartEmitter = game.add.emitter(x, y - 150, 20);
this.fullHeartEmitter = game.add.emitter(x, 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(x, y - 150, 20);
this.emptyHeartEmitter.makeParticles("heart_empty");
@@ -40,18 +58,24 @@ God.prototype.makeParticles = function(x, y) {
this.angryEmitter = game.add.emitter(x, y - 200, 20);
this.angryEmitter.makeParticles("smoke");
this.angryEmitter.width = 30;
this.angryEmitter.height = 30;
this.angryEmitter.width = God.HEAD_WIDTH;
this.angryEmitter.height = God.HEAD_HEIGHT;
this.angryEmitter.setRotation(-90, 90);
this.angryEmitter.setAlpha(0.1, 0.3);
this.angryEmitter.setAlpha(
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 = 0xf0f0f0;
particle.tint = 0xa08080;
}
);
}
@@ -104,6 +128,7 @@ God.prototype.animateAngry = function(type) {
tween.onComplete.add(this.smileAgain, this);
tween.start();
// this.particleBurst(God.REACTION_HAPPY);
this.particleBurst(God.REACTION_ANGRY);
}
@@ -122,15 +147,15 @@ God.prototype.particleBurst = function(reaction) {
switch(reaction) {
case God.REACTION_HAPPY:
this.fullHeartEmitter.start(true, 900, 100, 15, true);
this.fullHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 10, true);
break;
case God.REACTION_SMILE:
this.emptyHeartEmitter.start(true, 900, 100, 15, true);
this.emptyHeartEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 15, true);
break;
case God.REACTION_ANGRY:
this.angryEmitter.start(true, 900, 100, 15, true);
this.angryEmitter.start(true, God.EFFECT_LIFE_TIME_MS, 100, 20, true);
break;
}
}
@@ -139,6 +164,11 @@ God.prototype.particleBurst = function(reaction) {
God.POSITION_X = GAME_SCREEN_SIZE.x - 120;
God.POSITION_Y = 340;
God.HEAD_WIDTH = 80;
God.HEAD_HEIGHT = 30;
God.EFFECT_LIFE_TIME_MS = 1200;
God.REACTION_HAPPY = 0;
God.REACTION_SMILE = 1;
God.REACTION_ANGRY = 2;