From 349792f9166c2cf89210394f1c801db6507014f7 Mon Sep 17 00:00:00 2001 From: Mal Date: Sun, 17 Sep 2023 14:29:42 +0200 Subject: [PATCH] Racing conditions at loading time fixed --- index.html | 2 +- js/module.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 22b0be2..a1c50e3 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@ - + diff --git a/js/module.js b/js/module.js index b2eeef1..c7002ca 100644 --- a/js/module.js +++ b/js/module.js @@ -56,13 +56,6 @@ class Game this.loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); new FrameRateMeasurer(); - - window.addEventListener( - 'imagesloaded', - () => { - this.init(); - } - ); } render(timestamp) @@ -293,4 +286,11 @@ const level = Level.createFromFile( ); let game = new Game(level); -game.init(mainLoop); + +window.addEventListener( + 'imagesloaded', + () => { + game.init(mainLoop); + } +); +