Home > Articles > Programming > Games

Programming Animated Backgrounds and Explosion Sprites

  • Print
  • + Share This
This lesson guides you through the design and development of a game called Meteor Defense that is loosely based upon the classic Missile Command arcade game. Along with demonstrating a variety of different game programming techniques, the Meteor Defense game shows how to take advantage of animated backgrounds and explosion sprites.

See all Sams Teach Yourself on InformIT Programming Tutorials.

This chapter is from the book

This hour guides you through the design and development of another complete game. You've spent the past couple of hours learning how to animate the appearance of sprites and spruce up the background of games, and it's now time to put this knowledge to work in an entirely new game. The game is called Meteor Defense, and it is loosely based on the classic Missile Command arcade game. Seeing as how there have been several news reports in the past few years about the potential of a significant meteor collision with the Earth, I thought it might make a neat premise for a game. It wouldn't necessarily be a bad idea to have a missile-based system for stopping incoming meteors, which is the premise behind the game Meteor Defense.

In this hour, you'll learn:

  • About the conceptual overview of the Meteor Defense game

  • How to design the Meteor Defense game

  • How to add a few new sprite features to the game engine

  • What it takes to build the Meteor Defense game

  • How much fun it can be testing a new game

How Does the Game Play?

One of the classic arcade games that many people remember is Missile Command, which involves the defense of a group of cities against a nuclear attack. The nuclear attack involves missiles that travel down from the top of the screen toward the cities at the bottom. Your job is to fire upon the missiles and destroy them before they reach the cities. Although Missile Command made for an interesting game in the era of the hit movie War Games, the threat of nuclear attack is somewhat diminished these days, at least in terms of what most of us perceive as a realistic threat. However, there has been increasing talk in the past few years of the possibility of a meteor striking the Earth and causing major damage.

The premise of the game you develop in this hour is similar to Missile Command in that you're defending helpless cities against an incoming threat. In this case, however, the threat is giant meteors, not nuclear warheads. The Meteor Defense game employs a game play strategy similar to Missile Command in that you fire missiles at the incoming meteors to stop them from destroying the cities below. As you'll find out, the critical skill to becoming a good player at Meteor Defense (and Missile Command as well) is learning how to target a meteor and give a missile time to get there. In other words, you often have to lead a meteor by a certain distance to give the missile time to get there and make contact.

The object of Meteor Defense is to simply protect the cities against the incoming meteors for as long as possible. One interesting aspect of the game is that you lose points whenever you fire a missile, which makes it important to be efficient when you fire on the meteors. In other words, if you unleash missiles indiscriminately, you will no doubt protect the cities but your score will suffer. This is a subtle way to discourage sloppy game play. Small touches like this can often make a game much more appealing to serious game players.

  • + Share This
  • 🔖 Save To Your Account