From d80a4b7928cf801faa0a9b936f63c7db9d4089c5 Mon Sep 17 00:00:00 2001 From: Paolo Brasolin <paolo.brasolin@eurac.edu> Date: Mon, 14 Mar 2022 23:49:18 +0100 Subject: [PATCH] feat: drop clues on correct guesses #fe --- frontend/src/js/clue.ts | 11 +++++++++++ frontend/src/js/fight_scene.ts | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/src/js/clue.ts b/frontend/src/js/clue.ts index d13ab82..04cc261 100644 --- a/frontend/src/js/clue.ts +++ b/frontend/src/js/clue.ts @@ -43,6 +43,17 @@ class Clue extends Phaser.GameObjects.Sprite { duration: 100, }); } + + delete() { + this.scene.tweens.add({ + targets: this, + alpha: 0, + ease: "Linear", + delay: 0, + duration: 500, + }); + this.destroy(); + } } export default Clue; diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index ec046f6..315ee85 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -185,13 +185,14 @@ export default class FightScene extends Phaser.Scene { }); } - shootSpear(enemy: Phaser.GameObjects.Sprite, hit: boolean) { + shootSpear(enemy: Critter, hit: boolean) { const scene = this; if (!hit) { this.showMissMessage(); } else { this.showHitMessage(); // TODO: ew. + enemy.clue.delete(); scene.foes.splice(scene.foes.indexOf(enemy), 1); // FIXME } -- GitLab