Racing conditions at loading time fixed
This commit is contained in:
parent
593d323aff
commit
349792f916
|
@ -18,7 +18,7 @@
|
||||||
</style>
|
</style>
|
||||||
<link rel="shortcut icon" type="image/png" href="favicon.png">
|
<link rel="shortcut icon" type="image/png" href="favicon.png">
|
||||||
<link rel="stylesheet" type="text/css" href="tilorswift/style.css">
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="canvas"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
|
|
14
js/module.js
14
js/module.js
|
@ -56,13 +56,6 @@ class Game
|
||||||
this.loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png');
|
this.loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png');
|
||||||
|
|
||||||
new FrameRateMeasurer();
|
new FrameRateMeasurer();
|
||||||
|
|
||||||
window.addEventListener(
|
|
||||||
'imagesloaded',
|
|
||||||
() => {
|
|
||||||
this.init();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render(timestamp)
|
render(timestamp)
|
||||||
|
@ -293,4 +286,11 @@ const level = Level.createFromFile(
|
||||||
);
|
);
|
||||||
|
|
||||||
let game = new Game(level);
|
let game = new Game(level);
|
||||||
|
|
||||||
|
window.addEventListener(
|
||||||
|
'imagesloaded',
|
||||||
|
() => {
|
||||||
game.init(mainLoop);
|
game.init(mainLoop);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue