HTML and CSS Reference
In-Depth Information
// game.physics.showDebugDraw();
game.score = 0;
game.currentLevel = game.levels[levelSelection.levels.
isPlaying = true;
5. Whenever we increase the score, we request the view to update the scoreboard:
game.increaseScore = function() {
// existing code goes here.
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.result; }
// assign to images object for assets.js to use
loader.addEventListener("complete", game.start);
7. Finally, we replace the game.start() calling with the game.load() method:
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.
Search WWH ::

Custom Search