HTML and CSS Reference
In-Depth Information
Chapter 1
Flying Before You Walk
What's in this chapter?
• Creating the HTML5 for a game
• Loading images and drawing on canvas
• Setting up your game's structure
• Creating an animated background
• Listening for user input Code Downloads for this Chapter
The code downloads for this chapter are found at
title.cgi?isbn=9781118301326 on the Download Code tab. The code is in the chapter 01 download and indi-
vidually named according to the names throughout the chapter.
Games have long been a medium that pushes technology to its limits. This topic continues that proud tradition
by taking the core technologies of the web—HTML, CSS, and JavaScript—and pushing them to the edges of
their capabilities and performance. HTML5 as a game medium has come a long way capability-wise in a short
amount of time, and many people believe in-browser gaming will be one of the primary distribution mechan-
isms for games in the coming years.
Even though it's not an environment originally designed for creating games, HTML5 is actually a nice, high-
level environment for doing just that. So, in lieu of trying to abstract away all the boilerplate by building an
engine immediately, you can get right to the good stuff: a one-off game built from the ground up on HTML5—a
top-down 2-D space shooter called Alien Invasion .
Building a Complete Game in 500 Lines
To drive home the point of how easy it is to build games in HTML5, the final game you build in the first three
chapters contains fewer than 500 lines of code, all without using any libraries.
Search WWH ::

Custom Search