CSE 341
Assignment 6: Space Invaders in Java

Design due on Friday, 13-August-1999
Final version due on Wednesday, 18-August-1999
Demonstrations and grading on Friday, 20-August-1999

(See bottom for details on submitting)


In this assignment, you will be designing and implementing in Java your own version of a now vintage video game called Space Invaders. You are provided with some code to start with in the form of an abstract base class, AnimationApplet.

You are to work in groups of three. All three teammates will receive the same grade.

The primary goals of this assignment are...

the game

The idea of Space Invaders is very simple, and you have probably seen the game before, but here is a brief description to refresh your memory:

The player controls a ship which can move laterally (left and right) and shoot laser pulses or some other futuristic bullet equivalent at rows of alien monsters above which move back and forth while slowly descending toward the ship. The ship is destroyed (and the game thus ends) if any of the monsters reach the bottom of the screen (or, alternately, if any of the monsters crashes into the ship).

Space Invaders screen shot Galaxian screen shot
Space Invaders and Galaxian are two examples of commercial implementations of this kind of game.

the code

Beyond the basic game design described above, the details are left up to you. This includes rules about how the aliens move, what kinds of aliens there are, whether the aliens can shoot back at you, etc.

You are required (and will probably find it helpful) to extend a prewritten abstract class called AnimationApplet. This class is a general framework designed to make simple frame-by-frame animation easy to develop. You may not change the source code to this class. If you feel something needs to change that you cannot manage via subclassing, you must email Ken with your requested change---all changes to the class are at his discretion! Also note that we reserve the right to give you a new and improved implementation of this class, so you should rely only on its public interface.

Source code for a sample class which extends AnimationApplet to animate a small, bouncing ball is also provided. Be sure to read the class documentation for these files:

Read the provided source code carefully and make sure you understand the basic structure of AnimationApplet before beginning your program design. Part of section tomorrow will be devoted to a walk-through of the provided code and discussion of when the Applet class' init(), start(), and stop() methods are called, as well as how a pair of threads are used to perform the animation.

As you design your version of the game, keep in mind that good OO design is more important than flashy game features. Ideally, you'll end up with both: flashy features whose implementations greatly benefit from sophisticated class, interface, and class hierarchy design.

There are parts of the given code which you are not expected to fully understand. This includes, for instance, the way the notify() and wait() methods are used and the various usages of the synchronized keyword. Web documentation exists on the following relevant topics for those who are interested in understanding the code more completely:

what to submit when

thoughts on an approach


Back to the 341 home page...
Last modified: Thu Aug 19 14:41:32 PDT 1999