Added block animations, misc ui fixes

This commit is contained in:
Mashy
2019-01-05 12:08:10 +10:00
parent 2ae764a3a3
commit bdd8997141
7 changed files with 41 additions and 27 deletions
+10 -17
View File
@@ -15,7 +15,7 @@ const animationParams = (isAlly) => {
return { spawnLocation, speed, img, angleMin, angleMax };
};
const randomAnimation = () => {
const randomAttack = () => {
const animations = ['wall', 'spit', 'gravBlast', 'gravBomb', 'chargeBall'];
return animations[Math.floor(Math.random() * 5)];
};
@@ -27,25 +27,18 @@ class CombatSkills extends Phaser.GameObjects.Group {
}
getSkill(type, isAlly, castLocation) {
if (type === 'attack') {
this[randomAnimation()](isAlly);
const genericHeal = ['Heal', 'Triage', 'TriageTick'];
const genericBlock = ['Block', 'Parry', 'Evasion', 'Shield'];
if (genericHeal.includes(type)) {
this.genericHeal(isAlly, castLocation);
} else if (genericBlock.includes(type)) {
this.genericBlock(isAlly);
} else {
this[type](isAlly, castLocation);
this[randomAttack()](isAlly);
}
}
Heal(isAlly, castLocation) {
this.genericHeal(isAlly, castLocation);
}
Triage(isAlly, castLocation) {
this.genericHeal(isAlly, castLocation);
}
TriageTick(isAlly, castLocation) {
this.genericHeal(isAlly, castLocation);
}
genericHeal(isAlly, castLocation) {
// const { sourceX, sourceY } = getCrypPosition(sourcePos, 0);
const lifespan = DELAYS.ANIMATION_DURATION;
@@ -88,7 +81,7 @@ class CombatSkills extends Phaser.GameObjects.Group {
this.scene.time.delayedCall(lifespan, () => { emitter.stop(); }, [], this);
}
Block(isAlly) {
genericBlock(isAlly) {
const lifespan = DELAYS.ANIMATION_DURATION;
const colour = randomColour();
const x = isAlly ? COMBAT.width() * 0.3 : COMBAT.width() * 0.7;