CS2 Project 5: Graphics and Events
Due: Thursday Dec 13th at 11:59pm (this is reading day).
You will build a simplified version of the old (or shall we say "classic")
Arcade game sometimes called Galaga and sometimes Galaxian. (there were
subtle differences but they were essentially the same game).
For those of you who haven't seen the refresh on a portable game device, the
game looks something like the one below:
Players control a ship which is at the bottom of the screen. Players can
only move the screen horizontally back and forth. The ship can fire some
sort of shot at the enemies at the top of the screen.
The enemies will move back and forth horizontally while staying within their
rows. Occasionally one of them will fire down the screen in hopes of hitting
the players ship. Once in a while on of the attacking enemies will break
formation and dive down the screen as well.
In your project you will write a simple one level galaga/Galaxian
- You need a player ship at the bottom of the screen.
- The player ship needs to be able to fire (you can use a mouse button
or a key for this)
- The player ship needs to be able to move left and right (use
mousemovement or a key for this)
- You need three types of enemy ship
- each row of enemies should be full of a different enemy type.
- Occasionally one of the enemy ships should fire at the player. (no
more than one fire per second and no less than one fire per 5 seconds
- an easy way to do this is to set a low probability of firing, then
at each update, select a random number and if it is within that low
probability, then fire, else do nothing at that timestep.
- The enemy ships should be destroyed when hit by the player fire.
- each type of enemy should be worth a different amount of points.
- You need to keep score.
- this could be shown to the user anywhere.
- If the player kills all of the enemy ships the player wins
- you need to stop the game at this point and announce the win
- the player should start out with 3 "lives"
- you can show the player this by whatever means is convenient
- you could show the player via text, via a number of extra ship
icons (as in the original game) or in whatever other means make
- if the player loses all three 'lives' then the player loses the
game, stop the game and announce the loss.
I have made a set of images available to you. Refer to class discussion for
I'll also recommend some starting points and progression in completing this
project in class.
Extra credit is available for this project for those who have finished the
above required parts of the project. (if enough of the actual project is not
finished, you will not be eligible to be graded for the extra credit) This
final project will be worth 200+ points (making your 70 point first project
small potatoes in comparison). This will give you a feel for how the extra
credit is weighted. You may do any, all or none of the extra credit options
below. Be sure to tell me (in the readme file) if you did do any so you can
get credit for them.
- Add sound effects (20pts) add a different sound for each of the
- when firing,
- when an enemy or player ship gets killed
- When the player wins
- When the player loses
- Add a kamikaze enemy (15pts)
- occasionally, one of the enemies tries to dive bomb the player.
- Add an extra "life" bonus (15pts)
- Add a mechanism to gain an extra life - either through score or as a
special enemy. Be sure to inform the user graphically or via audio (if
you did part 1 above) about the extra life.
I am placing the following restrictions on you to encourage you
to practice good software design.
- You must comment your code, each method at least must contain a
comment describing what the method does. If the method is more
complicated, additional comments are appropriate.
- No method may be more than 30 lines long
- No single class can be more than 200 lines long.
- make sure you increase cohesion: that is each class should represent a
When your program is ready, you need to write a readme.txt
file that provides me the following information:
The name of your java files (and the
names of any extra non-public classes that are contained in the file.
- in particular the name of the java class with the main method in it
The implementation decisions that you
made. Why did you solve the problem the way that you did?
Directions on running and using your
program. How do I fire? How do I move the ship? How do I know how many
lives I have? etc.
- because I'm running on a mac. please don't require the control key
and one of the arrow keys at the same time.
And any problems or bugs left in your program. If your program
doesn't quite work in some situations, tell me about it. If your
program doesn't run or compile, I want to know that before I try.
- If you tried for any extra credit, let me know that as well.
When your readme and your code is ready, zip up your files and submit them
online as you have done for the other labs