diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index 828fdc26c363f051a68fb3dd20a0aff72e2ba2cf..1a212eba4d2c552c26a294dbc0f73f77bf0aec1e 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -213,6 +213,10 @@ export default class FightScene extends Phaser.Scene { return result; } + popFoe(foe) { + this.foes.splice(this.foes.indexOf(foe), 1); + } + submitTranscription(inputStatus: InputStatus) { const { score, match } = this.findMatchingFoe(inputStatus.final); // TODO: visual near misses based on score @@ -223,7 +227,7 @@ export default class FightScene extends Phaser.Scene { this.showMissMessage(); new Spear(this, this.player, undefined); } else { - this.foes.splice(this.foes.indexOf(match), 1); + this.popFoe(match); match.handleSuccess(); this.showHitMessage(); new Spear(this, this.player, match.critter); diff --git a/frontend/src/js/foe.ts b/frontend/src/js/foe.ts index c588a637e1ca0a4497e2150511a79b55f3dadc51..764ca57e9efa5eb9ae214eb09dd4cdd171a96052 100644 --- a/frontend/src/js/foe.ts +++ b/frontend/src/js/foe.ts @@ -41,6 +41,8 @@ class Foe { this.critter, () => { this.scene.physics.world.removeCollider(overlap); + this.scene.popFoe(this); + this.clue.delete(); this.critter.escape(); }, );