Added block animation

This commit is contained in:
Mashy
2018-12-14 16:07:20 +10:00
parent d225843e35
commit dedb9d8b96
3 changed files with 51 additions and 11 deletions
+38 -3
View File
@@ -30,15 +30,16 @@ class CombatSkills extends Phaser.GameObjects.Group {
if (type === 'attack') {
this[randomAnimation()](isAlly);
} else {
this.heal();
this[type](isAlly);
}
}
heal() {
Heal(isAlly) {
const lifespan = DELAYS.ANIMATION_DURATION;
const particles = this.scene.add.particles(randomColour());
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
const emitter = particles.createEmitter({
x: COMBAT.width() * 0.3,
x,
y: COMBAT.height() * 0.2,
angle: { min: 250, max: 290 },
speed: 250,
@@ -50,7 +51,41 @@ class CombatSkills extends Phaser.GameObjects.Group {
});
this.add(particles);
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
}
Block(isAlly) {
const lifespan = DELAYS.ANIMATION_DURATION;
const colour = randomColour();
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
const emitter1 = this.scene.add.particles(colour).createEmitter({
x,
y: COMBAT.height() * 0.4,
scale: { start: 0.75, end: 0.25 },
blendMode: 'ADD',
emitZone: {
source: new Phaser.Geom.Rectangle(-100, -100, 200, 200),
type: 'edge',
quantity: 24,
yoyo: true,
},
});
const emitter2 = this.scene.add.particles(colour).createEmitter({
x,
y: COMBAT.height() * 0.4,
blendMode: 'SCREEN',
scale: { start: 0.2, end: 0 },
speed: { min: -100, max: 100 },
quantity: 50,
active: false,
emitZone: {
source: new Phaser.Geom.Rectangle(-100, -100, 200, 200),
type: 'edge',
quantity: 50,
},
});
this.scene.time.delayedCall(lifespan / 2, () => { emitter1.stop(); }, [], this);
this.scene.time.delayedCall(lifespan / 2, () => { emitter2.active = true; }, [], this);
this.scene.time.delayedCall(lifespan, () => { emitter2.stop(); }, [], this);
}
wall(isAlly) {