CS 204: Software Design

Due 8:30AM Friday, 8 May 2009
You may work with a partner for this assignment.

Animation with Java and inheritance

The purpose of this project is to get you warmed up on programming in Java, and to start you thinking about program structures that make use of polymorphism and inheritance.

Run-time behavior

Your program will start with a class named Animation.java, which will have the main method that launches the program. You'll run your program via a command line like this:

java Animation sprites.txt 500 300

where sprites.txt contains a textual description of the various objects (sprites) that will be moving around in your animation, and 500 and 300 are examples of the animation window width and height, in pixels.

When you run this program, some sort of animation will take place. Spaceships in space, butterflies in a meadow, cars in a city, zombies in the park, or whatever strikes your fancy. The keys to this program will be the use of Java and adherence to the structure described in the next section, so the particulars of your animation don't matter a great deal.

I know that some of you likely did a similar project in CS 111 (or 117 if you've been around here long enough). If so, just start this one fresh, pay attention to the guidelines below, and pick a new animation context.

Program structure

Your program will consist of:

Sprite file format

The sprite file will consist of lines of text, one per sprite, of this format:

type x y vx vy [other info required by the sprite type]

For example:

goat 200 100 10 0 purple

would, presumably, cause the instantiation of an object of type Goat with initial position (200, 100) and initial velocity (10, 0) and initial color purple.

You are free to add features to your particular sprite types, making corresponding additions to the "other info" section of the sprite description line in the sprites file.

Questions? Let me know.

Have fun.