Chapter 7. Using conditionals to build your fixed shooter

 

You’ve probably figured out by now that the way people invent new video games is to look at old video games. If a video game is a big success, other game companies try to imitate it, making small changes to the visuals or goals of the game while keeping the same mechanics. That’s what happened when Intellivision noticed the popularity of Atari’s Asteroids.

Asteroids was released in 1979 and was a huge success. The player controlled a space cannon flying in outer space that could spin around and shoot at the rocks falling around them. Intellivision made its version—Astrosmash—in 1981, moving the space cannon to the ground, the colorful rocks to the sky, and adding a few extra enemies such as spinning bombs.

But don’t think that Intellivision is just a copycat. Asteroids was based on the game Spacewar! And Spacewar! probably would have been based on something else if it wasn’t one of the first video games. The game industry has a long history of creating similar games, which makes it easy for players to pick up a new game and immediately understand their goal and how to move their sprite.

Like Astrosmash, the goal of Wizards vs. Ghosts is to shoot the ghosts coming at you with sparks from your wand while trying not to get hit by any of the apparitions. The ghosts won’t break apart like the rocks in Asteroids or Astrosmash but instead disappear from the screen when blasted by the wizard’s spell, as shown in figure 7.1.

Preparing to program

Programming the wizard

Answer This: Why 10 Coordinates?

Programming the ghosts

Answer This: What Does the One Second Delay Do?

Answer This: How Do You Decide the Numbers in a Scoring System?

Programming the sparks

Programming the odds and ends

Answer This: Why Set the X and Y Coordinates to Zero with the Barrier Line?

Troubleshooting your game

Learning in action