Figure 8-1. The basic HTML file for Chapter 8
Next, we will begin to make our Asteroids-like game, which we’ve named Geo Blaster
Basic. See Figure 8-7 for an example of the final game in action.
Our Game’s Design
We are not going to assume that everyone who reads this chapter knows of or under‐
stands Atari’s classic arcade game Asteroids. So let’s start by taking a peek at the Aste‐
roids game-play elements.
Asteroids, designed by Ed Logg and Lyle Rains, was released by Atari in 1979. The game
pitted a lone triangular two-dimensional vector spaceship (the player ship) against
screen after screen of asteroid rocks that needed to be dodged and destroyed. Every so
often a space saucer would enter the screen attempting to destroy the player ship.
All asteroids started the game as large rocks; when they were hit, they would split into
two medium-sized rocks. When hit by a player missile, these medium-sized rocks would
then split into two small rocks. The small rocks would simply be destroyed when hit.
(Small was the final size for all asteroids.)
When the player destroyed all the asteroids, a new screen of more and slightly faster
asteroids would appear. This went on until the player exhausted his three ships. At each
10,000-point score mark, the player was awarded an extra ship.
All of the game objects moved (thrusting, rotating, and/or floating) freely across the
entire screen, which represented a slice of space as a flat plane. When an object went off
the side of the screen, it would reappear on the opposite side, in warp-like fashion.
Game Graphics: Drawing with Paths
Let’s jump into game development on Canvas by first taking a look at some of the
graphics we will use in our game. This will help give us a visual feel for what type of
code we will need to implement.
444 | Chapter 8: Canvas Games: Part I