From 0b44a3bc47c471e9f2f9b619f3a8a5cd29e904de Mon Sep 17 00:00:00 2001 From: Paolo Brasolin <paolo.brasolin@eurac.edu> Date: Tue, 29 Mar 2022 17:50:43 +0200 Subject: [PATCH] fix: #fe double input --- frontend/src/js/fight_scene.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index a3b5c6f..5affa32 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -323,7 +323,7 @@ export default class FightScene extends Phaser.Scene { } initAndBindGuessPreview() { - this.typewriter = new Typewriter(); + this.typewriter ??= new Typewriter(); this.typewriter.setHidden(this.game.device.os.desktop); this.typewriter.onSubmit = (inputStatus) => { if (inputStatus.began_at === null) return; @@ -353,7 +353,7 @@ async function spawn(scene: any) { scene.time.now; const delay = (8 * 1000 * (60 * 1000 - scene.time.now)) / 60 / 1000 + 2 * 1000; - setTimeout(() => spawn(scene), 200); + setTimeout(() => spawn(scene), Math.min(200, delay)); } async function spawnFoe(scene: FightScene) { -- GitLab