In this recipe, we will look at the necessary steps required to create and implement a level. This will be done by implementing a level object and updating the games framework to handle the loading and drawing of modular 2D tile assets. This modular construction allows levels to be designed with varying environmental layouts and sizes.
Mainobjects as well as introduce a level manager object. Go ahead and open the
Mainobject and add the following declaration below where we declared and loaded our player sprite:
var tile = new Image(); tile.src = "textures/tile.png";