I wouldn't be surprised if some of you bought this book solely for this chapter—after all, what fun is it to master the HTML5 canvas without being able to create your own video games? Of all the chapters in this book, this chapter was by far my favorite (with the next chapter being a close second). We might not actually be able to save the world with game development, but it sure is fun to create our own virtual worlds and save those instead. In this chapter, we're going to pull all of our new found knowledge together to create Canvas Hero, a side-scroller action game starring the Canvas Hero, who can run, jump, levitate, and punch through a futuristic world full of menacing bad guys. Here are some of the features of the game:
The hero can run left, run right, jump, and punch to attack
The level will look futuristic
The level will be full of enemies running around looking for trouble
The level will have a foreground image that moves to the left and to the right as the player moves...