From eba81f441d61002d0e27d0801c95030feeae8d3f Mon Sep 17 00:00:00 2001 From: Paolo Brasolin <paolo.brasolin@eurac.edu> Date: Mon, 11 Apr 2022 18:21:40 +0200 Subject: [PATCH] fix: #fe remove spawner at game over --- frontend/src/js/fight_scene.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index a22bcc9..a28b551 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() { -- GitLab