Added heals and removed enemy hitbox in target phase

This commit is contained in:
Mashy
2018-12-13 18:12:44 +10:00
parent b43fc44303
commit aca21d267d
4 changed files with 44 additions and 15 deletions
+32
View File
@@ -15,12 +15,44 @@ const animationParams = (isAlly) => {
return { spawnLocation, speed, img, angleMin, angleMax };
};
const randomAnimation = () => {
const animations = ['wall', 'spit', 'gravBlast', 'gravBomb', 'chargeBall'];
return animations[Math.floor(Math.random() * 5)];
};
class CombatSkills extends Phaser.GameObjects.Group {
constructor(scene) {
super(scene);
this.scene = scene;
}
getSkill(type, isAlly) {
if (type === 'attack') {
this[randomAnimation()](isAlly);
} else {
this.heal();
}
}
heal() {
const lifespan = DELAYS.ANIMATION_DURATION;
const particles = this.scene.add.particles(randomColour());
const emitter = particles.createEmitter({
x: COMBAT.width() * 0.3,
y: COMBAT.height() * 0.2,
angle: { min: 250, max: 290 },
speed: 250,
gravityY: 1000,
quantity: 4,
scale: { start: 0.1, end: 1 },
blendMode: 'ADD',
lifespan,
});
this.add(particles);
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
}
wall(isAlly) {
const lifespan = DELAYS.ANIMATION_DURATION;
const { spawnLocation, speed, img } = animationParams(isAlly);