Chapter 7. Levels, Sound, and More

In this chapter, we’ll add a few finishing touches to Bubble Shooter and cover a few more features of HTML5. Right now, the bubble grid could fill up the entire page in no time, giving players no room to fire bubbles. To prevent this from happening, we’ll make the game end if the player adds more than two rows to the bottom of the board. We’ll also implement multiple levels and high scores using the Local Storage API, smooth out animation with requestAnimationFrame, and add sound to the game with HTML5. Let’s start by adding multiple levels and high scores.

Multiple Levels and High Scores

It’s possible to complete a level by clearing out all of the bubbles, but thereafter, if you want to play again, you must refresh ...

Get Build an HTML5 Game now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.