HTML and CSS Reference
In-Depth Information
You need to increment the score counter every time a brick is hit. To do so, add logic to
increment Hud.score by modifying Bricks.collide() with the following listing.
Note that you already added the code to fire the level up earlier in a Brick.draw() list-
ing, so you don't need to worry about that.
Listing 6.16. game.js—Adjusting brick destruction
Next, increment the ball's speed in Ball.init() and multiply the number of bricks in
Bricks.init() with a level multiplier. A level multiplier is a technique that scales cer-
tain properties based on a player's current level. Using the level multiplier in the following
listing, you can change object properties when a level up occurs.
Search WWH ::




Custom Search