In this task, we show the bitmap graphics by loading them into the game.
In this task, we add the colored bitmaps and load them onto the game. These bitmaps are colored and exported from Adobe Flash.
So, make sure we have the PreloadJS
file ready in the vendors
folder and in the index.html
file:
<script src="vendors/preloadjs-0.4.1.min.js"></script>
Let's follow the given steps to load the graphics into the game:
In the
game.js
file, we define theload
method:game.load = function() { // load bitmap assets before starting the game var loader = new createjs.LoadQueue(false); loader.addEventListener("fileload", function(e){ if (e.item.type === "image") { images[e.item.id] = e.result; } // assign to images object for assets.js to use }); loader.addEventListener("complete", game.start); loader.loadManifest(lib.properties.manifest); }
We originally have the
game.start()
function calling in the...