HTML and CSS Reference
In-Depth Information
Listing 6.17. game.jsāBall and brick upgrades
When a level up occurs, everything except the
Hud
needs to be updated with a new method
called
Game.levelUp()
. Problem is, allowing players to level up past 5 will cause
your game's bricks to take over the screen. To prevent brick overflow, you need to add a
Game.levelLimit()
method and modify the
Bricks.init()
logic to use it. Once
you've inserted the code from the next listing, Canvas Ricochet can be played with mul-
tiple levels.