Comp152 Project 5: Graphics and Games
Due: Thursday December 12th at
11:55pm (Reading Day)
For those of you who want to just use some premade
images use this zip file.
Objectives:
In this project you will have the opportunity to:
- Write a larger/more significant project than you have so far:
providing a fitting capstone for your cs1/cs2 experience
- Work with Graphics
- Work with keyboard and mouse inputs/events
- Practice with linear collections
- practice nearly all of the techniques and cs concepts that you have
learned over the last two semesters.
Details:
In this final project I generally have students implement some 1980s video
game in java. In the 1980s those games were major undertakings, but the
libraries that java gives us the chance to make them as a culminating
project for a comp152 class.
You will implement a simplified version of the 1980s video game megamania -
named by one site as the most underated atari video game of the 1980s.
It was available for both the atari 2600 console and the revamped 5200
console. After all who can resist fighting cookies and hamburgers!
Here
is a description of the game
A you tube review of
the atari 2600 version of the game
A short playthrough
video of the 5200 version of the game.
We are going to implement a simplified version of the game. Your program
must have the following features
- You must have a ship which represents the player
- the players ship must move back and forth horizontally just above
the information area of the window (see below)
- the player ship must respond to mouse or keyboard events to
control the movement.
- if the player ship collides with any enemies or with an enemy shot
it is destroyed and the player loses one ship (one life)
- when the player loses a ship, the game should continue with the
next ship if the player has any more ships (lives) left.
- A player ship can fire a shot (see shots below) no more than once
every 100 milliseconds.
- A player that is out of energy (see below) dies (lose a ship/life)
- if you use keyboard navigation then respond to the arrow keys as I'm
left handed. (WSAD doesn't work for me)
- You must have energy for the ship.
- you need an energy bar to represent the remaining energy. You should
start out with 1000 energy
- Each shot should take 40 energy.
- Each enemy hit should return 20 energy to the ship
- You must have 20 moving enemies that work like the hamburgers in the
first level of megamania. (the hamburgers)
- these enemies can be any image you want so long as they are not used
elsewhere in the program, have a transparent background, and are
appropriate for classroom use.
- The enemies must be in three rows with alternating locations like in
the hamburger level.
- The enemies must move horizontally across the screen - exiting from
the right hand of the screen and reentering on the left.
- The enemies must shoot occasionally. One enemy should shoot every
1-5 seconds. (accomplish that how you like)
- You must have a way of letting the player ship shoot.
- the shot should use energy as detailed above.
- if a shot hits an enemy, then the shot and the enemy should
disappear.
- the ship should also regain 20 energy when the shop collides with
the enemy.
- The players score should go up by 40 when the enemy is destroyed.
- if a shot hits an enemy shot, both shots should disappear.
- Your player has three extra ships/ lives at the start of the game
- represent this in your game somewhere so the player can see how many
ships the player has remaining.
- Each time the players ship 'dies' (collides with an enemy or hit by
an enemy shot)
- if there is a remaining ship, the player should have a new ship
appear about a second later. It should be invulnerable to shots for
another second.
- this uses up one of the lives.
- when the last ship/life dies, the game should end.
- when the game ends this way, stop the game and show the user
his/her score and tell them he/she has lost
- If the player destroys all of the enemies then
- move to a second level, repeat the first with a different image and
a different movement pattern
- for every remaining energy point remaining, add one to the players
score.
- score
- display the players score somewhere that the player can see.
- For every thousand points that the player scores, the player gets an
extra life.
- Winning
- if the player clears the entire second level, the player wins the
game.
- stop the game and display the players score and a message about the
player winning.
I anticipate that this project will be worth about 260 points. That
should put the following extra credit possibilities in context. In
order to get extra credit, you must finish the main program above before
doing the extra credit. For extra credit you may do any of all of
the following.
- For 30 points: add the following sounds to your game.
- Have a sound for firing,
- a sound to begin the round
- a sound when an enemy is destroyed
- a sound when the players ship is destroyed
- a sound for winning
- a sound for losing the game
- For 25 points
- add another level with a third type of enemy and a third type of
enemy movement.
- For 15 extra points
- When the game is over there should be a way to restart the game
without restarting the program.
Extra Requirements:
You must satisfy the following constraints on your program
-
Your program should be well commented
-
No one method may be longer than 25 lines of code long
(Lines with only braces on them don't count. Since comments and
white space aren't code, they do not count either.)
-
Make sure each of your classes represents only a single concept.
You will need classes for at least the player ship, the enemies
and the game, and probably more than that.
Submitting:
When your program is ready, you need to write a readme.txt file that
provides me the following information:
-
Your name
-
The name of your java files (and the
names of any extra non-public classes that are contained in the file.
-
The implementation decisions that you
made. Why did you solve the problem the way that you did?
- Did you implement any extra credit? if so what?
-
Directions on running and using your
program. Especially anything that might not be the same for all
students. Give me directions for
running your game. How do I control the ship? how do I fire?
-
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.
When your readme and your code is ready, zip up your files and submit them
online as you have done for the recent labs