Now that we have all of the pieces for our game, including the graphics, the classes for the actors, the level, the health bar, and a completed game engine, it's time to tie it all together by setting up the HTML document and starting the game.
Follow these steps to set up the HTML document and start the game:
Link to the JavaScript files:
</style> <script src="animation.js"> </script> <script src="Controller.js"> </script> <script src="Model.js"> </script> <script src="View.js"> </script> <script src="Level.js"> </script> <script src="Actor.js"> </script> <script src="HealthBar.js"> </script>
Initialize the controller:
<script> window.onload = function(){ new Controller("myCanvas"); }; </script>
Embed the canvas inside the body of the HTML document:
<canvas id="myCanvas" width="900" height="600"> </canvas...