diff --git a/agent-test/templates/core3d/index.html b/agent-test/templates/core3d/index.html index 432b6fdbf..629d65596 100644 --- a/agent-test/templates/core3d/index.html +++ b/agent-test/templates/core3d/index.html @@ -3,6 +3,7 @@ + OpenGame 3D diff --git a/agent-test/templates/core3d/public/favicon.svg b/agent-test/templates/core3d/public/favicon.svg new file mode 100644 index 000000000..2bbc79a45 --- /dev/null +++ b/agent-test/templates/core3d/public/favicon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/agent-test/templates/core3d/src/main.ts b/agent-test/templates/core3d/src/main.ts index 2067f95be..3616f7997 100644 --- a/agent-test/templates/core3d/src/main.ts +++ b/agent-test/templates/core3d/src/main.ts @@ -23,6 +23,7 @@ class GameApp { private readonly gameOverUi = new GameOverUIScene(); private game?: GameScene; private lastFrame = performance.now(); + private ended = false; async boot(): Promise { if (!this.container) throw new Error('Missing #game-container'); @@ -30,7 +31,7 @@ class GameApp { this.title.show(() => this.start()); window.addEventListener('resize', () => this.game?.resize()); window.addEventListener('keydown', (event) => { - if (event.code === 'Escape' && this.game) { + if (event.code === 'Escape' && this.game && !event.repeat && !this.ended) { if (this.game.isPaused()) this.resume('GameScene'); else this.pause('GameScene'); } @@ -45,10 +46,12 @@ class GameApp { { onProgress: (collected, total) => this.ui.update(collected, total), onComplete: () => { + this.ended = true; this.game?.setPaused(true); this.completeUi.show(() => location.reload()); }, onGameOver: () => { + this.ended = true; this.game?.setPaused(true); this.gameOverUi.show(() => location.reload()); },