Chapter 4

Animation and Sprites

In the previous chapter, we created our first web game: a two-player version of Four Balls. This game is very simple. We only used graphical primitives to display the board: lines, circles, and gradients. Of course, there are a lot of other games that can be created with exactly the same set of tools, but what if we want to do something more exciting? A 2D platform shooter, perhaps?

Platform shooters usually have much richer graphics than puzzle games (see Figure 4-1). These games have a main character that can run, jump, and, obviously, shoot. Shooters also have “enemies,” items, terrain, and a lot of other elements to entertain the player. In other words, you need something more than circles and squares. You ...

Get Pro Android Web Game Apps: Using HTML5, CSS3 and JavaScript 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.