HTML and CSS Reference
In-Depth Information
// game.physics.showDebugDraw();
game.score = 0;
game.currentLevel = game.levels[levelSelection.levels.
currentFrame];
game.physics.createLevel();
game.view.showScoreBoard();
isPlaying = true;
});
5. Whenever we increase the score, we request the view to update the scoreboard:
game.increaseScore = function() {
// existing code goes here.
game.view.updateScore();
};
6. We have used some image files in this task, but we need to load them before we
can use them. We define the following
load
funcion. Actually, it is the same one
from the last task. We just reuse it:
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);
};
7. Finally, we replace the
game.start()
calling with the
game.load()
method:
game.load();
Objective complete - mini debriefing
We have improved the game low by showing the player a level selecion screen.
Choosing a level
We show an interface to let the player choose which level to play. In each level selecion,
we show the preview image and which ball is used in the level. The ball parameter includes
the ball size, mass, and bounce. These different parameters make each level unique and the
player needs a different strategy to shoot the ball.