diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index a22bcc953a3980e46b84b25f84d075b85a8c86ca..a28b5519a34f127294b945a21212c216f530e495 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -47,6 +47,7 @@ export default class FightScene extends Phaser.Scene { gameTime: Phaser.Time.TimerEvent; uiDimensions: UIDimensions; music!: Phaser.Sound.BaseSound; + spawner: Phaser.Time.TimerEvent; constructor() { super("fight"); @@ -352,6 +353,7 @@ export default class FightScene extends Phaser.Scene { ended_at_gmtm: this.getGameTime(), }) ).data; + this.spawner.remove(); this.foes.forEach((foe) => foe.destroy()); this.sound.play("sfx_game_over"); this.typewriter.setActive(false); @@ -465,7 +467,7 @@ export default class FightScene extends Phaser.Scene { (8 * 1000 * (60 * 1000 - this.getGameTime())) / 60 / 1000 + 2 * 1000, ); // TODO: it should be ok calling this on time instead of gameTime, but... is it? - this.time.delayedCall(delay, this.spawnFoes.bind(this)); + this.spawner = this.time.delayedCall(delay, this.spawnFoes.bind(this)); } async spawnFoe() {