Racing conditions at loading time fixed

This commit is contained in:
Mal 2023-09-17 14:29:42 +02:00
parent 593d323aff
commit 349792f916
2 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@
</style>
<link rel="shortcut icon" type="image/png" href="favicon.png">
<link rel="stylesheet" type="text/css" href="tilorswift/style.css">
<script type="module" src="js/module.js"></script>
<script type="module" src="js/module.js" defer></script>
</head>
<body>
<canvas id="canvas"></canvas>

View File

@ -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);
}
);