Cover by Raffaele Cecco

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 5. Introduction to JavaScript Games

On May 22, 2010, Google released its own version of the retro-classic, dot-chomping game Pac-Man. The game, developed to celebrate Pac-Man’s 30th anniversary, appeared in place of the usual Google logo on the search engine’s home page (Figure 5-1). Many people initially assumed that this fun remake was created with HTML5, but a closer inspection revealed that it used nothing more than regular DHTML (excluding the sound). Continuing with the retro-classic theme, in this chapter we will develop our own DHTML game: Orbit Assault, a variation of the legendary Space Invaders (Figure 5-2).

Pac-Man was a surprise addition to Google’s home page

Figure 5-1. Pac-Man was a surprise addition to Google’s home page

Orbit Assault, an arcade game—DHTML style

Figure 5-2. Orbit Assault, an arcade game—DHTML style

Actually creating an entire game from scratch might seem like heavy going, but it’s the best way to introduce many of the concepts involved in game development.

But why limit ourselves to DHTML? Why not jump straight into using something more powerful, like HTML5 Canvas? Think of it as high-altitude training: if we can create something good with just DHTML, we are equipped to create something even better using Canvas.

Space Invaders was released in 1978 by the Japanese Taito Corporation, and was developed by Tomohiro Nishikado. He not only designed ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required