Team animations come from source, skill buttons

This commit is contained in:
Mashy
2018-12-17 18:02:05 +10:00
parent 0d833f9b7d
commit 596e9968c0
3 changed files with 42 additions and 10 deletions
+27 -4
View File
@@ -26,18 +26,35 @@ class CombatSkills extends Phaser.GameObjects.Group {
this.scene = scene;
}
getSkill(type, isAlly) {
getSkill(type, isAlly, castLocation) {
if (type === 'attack') {
this[randomAnimation()](isAlly);
} else {
this[type](isAlly);
this[type](isAlly, castLocation);
}
}
Heal(isAlly) {
Heal(isAlly, castLocation) {
// const { sourceX, sourceY } = getCrypPosition(sourcePos, 0);
const lifespan = DELAYS.ANIMATION_DURATION;
const particles = this.scene.add.particles(randomColour());
const colour = randomColour();
const particles = this.scene.add.particles(colour);
const x = isAlly ? COMBAT.width() * 0.7 : COMBAT.width() * 0.3;
const emitter2 = particles.createEmitter({
x: castLocation.x,
y: castLocation.y,
moveToX: x,
moveToY: COMBAT.height() * 0.2,
speed: 500,
lifespan: lifespan / 3,
scale: { start: 0.5, end: 1 },
quantity: 3,
_frequency: 20,
blendMode: 'ADD',
emitZone: { source: new Phaser.Geom.Rectangle(-200, -100, 400, 200) },
});
const emitter = particles.createEmitter({
x,
y: COMBAT.height() * 0.2,
@@ -48,8 +65,14 @@ class CombatSkills extends Phaser.GameObjects.Group {
scale: { start: 0.1, end: 1 },
blendMode: 'ADD',
lifespan,
active: false,
});
this.add(particles);
this.scene.time.delayedCall(lifespan / 3, () => { emitter2.stop(); }, [], this);
this.scene.time.delayedCall(lifespan / 3, () => { emitter.active = true; }, [], this);
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
}