Considering HTML5 from a Game Perspective

In this chapter you’ve heard a lot about HTML5 but not much about how HTML5 can help you build games on mobile devices. This section discusses the main ways to build games with HTML5, and the next section covers mobile-friendly features that can make your games more interesting. Now look briefly at the three main ways you can build games from an HTML5 perspective. (Each of these is covered in much more detail in later chapters, and Chapter 12, “Building Games with CSS3” explains which method to pick for your specific game.)

Canvas

Canvas, which is discussed in detail in Chapter 15, “Learning Canvas,” and used throughout the book, is in many ways the most interesting feature game-wise of the actual HTML5 standard. It gives developers access to a fast frame buffer where you can draw images and graphics.

Most discussions of Canvas in this book mean 2-D canvas because that is the only canvas context that’s currently well supported on mobile devices. But there will be a discussion about the Webgl context briefly as well as support for 3-D canvas, which is poised to appear on mobile devices (or may already be there by the time this book gets in your hands). Figure 4-2 shows the canvas platformer built in Chapter 18, “Creating a 2D Platformer.”

Figure 4-2: A mobile 2D platformer.

c04f002.tif

CSS3/DOM

As you see in Chapter 12, “Building Games with CSS3,” ...

Get Professional HTML5 Mobile Game Development 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.