I make the game and I have a problem with loading it. If I refresh the page a couple of times, it all loads, but without this, as I did not try to do, nothing works. If I need javascript code, I will add, there’s just a lot.

body{ width: 100%; height: 100%; position: fixed; top: 0; left: 0; display: flex; align-items: center; justify-content: center; overflow: auto; background: url("image/bg.png") repeat; } p{ color: white; font-size: 50; margin-bottom: 0px; } 
 <!DOCTYPE html> <html> <head> <meta charset="Utf-8"> <title> Sietra </title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <canvas width="960" height="576" id="canvas" style="z-index: 0;"><p>Ваша версия браузера не поддерживает Canvas.<br>Обновите браузер!</p></canvas> <script src="image.js"></script> <script src="variable.js"></script> <script src="engine.js"></script> <script src="character.js"></script> <script src="enemy.js"></script> <script src="game.js"></script> </body> </html> 

Closed due to the fact that the essence of the question is not clear by the participants user194374, aleksandr barakin , Grundy , Bald , D-side 12 Jul '16 at 10:56 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • if the scripts did not load, why do we need your html code? The question is not correct, tell me what technologies you use when building the application, what errors take off - Vasily Barbashev
  • See what output is in the console when the problem occurs. If any errors come out there, then you need to understand depending on their text. - Xander
  • Scripts are loaded, no errors. But it does not load when you first start, if you refresh the page, everything is in order. - edikxl
  • Submitted everything by creating a button that loads the page if it has not loaded. - edikxl

1 answer 1

Submitted everything by creating a button that loads the page if it has not loaded.