diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index 799bdd4f463306be5c2f7fb08cdc0ae5fb9ec668..70a42430ce0d0a028b0f0d50d723cce8b0795520 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -356,12 +356,13 @@ export default class FightScene extends Phaser.Scene { } async spawnFoes() { - if (!this.scene.isActive()) return; await this.spawnFoe(); - const delay = - (8 * 1000 * (60 * 1000 - this.time.now)) / 60 / 1000 + 2 * 1000; // TODO: think of a progression which makes sense - setTimeout(this.spawnFoes.bind(this), Math.max(2000, delay)); + const delay = Math.max( + 2000, + (8 * 1000 * (60 * 1000 - this.time.now)) / 60 / 1000 + 2 * 1000, + ); + this.time.delayedCall(delay, this.spawnFoes.bind(this)); } async spawnFoe() {