Assignment 4
SuperZapem!
A Modestly Enhanced Zapem
In this assignment, you enhance your Zap'em! game. This programming assignment, beyond using features & classes that you have used before, gives you Java programming experience with the Java Swing GUI & the Graphics fillArc & fillPolygon methods.
As always (starting from the previous assignment), Javadoc your public methods & public classes.
Specification
SuperZapem! Game Enhancements Description
Enhance your Zap'em! game in the following ways:
- The game has a level of difficulty, initially set to 4. This level is displayed in a JTextField that has a suitable label to its left.
-
Add 2 new Critter subclasses.
At least 1 of them must use the Graphics
fillArc
method in its draw method, and at least 1 of them must use the GraphicsfillPolygon
method in its draw method. Please feel free to be as imaginative as you like with these new Critters. You also do not have to limit yourself to 2 new Critter subclasses. - In the enhannced version, the game duration is updated every time the
Timer
generates anActionEvent
. - If a completed game duration is greater than 10 seconds,
- Increase the Timer pause time by 20 milliseconds. It initially is set to 200 milliseconds.
- Decrease the game level by 1.
- Issue a message via a
JOptionPane
method that displays the new game level & supplies a suitable message to the player. (For fun, I issue an ERROR message.)
- Decrease the Timer pause time by 20 milliseconds.
- Increase the game level by 1.
- Issue a message via a
JOptionPane
method that displays the new game level & supplies a suitable message to the player.
- If you have not done so, move your
MouseListener
code frommouseClicked
tomousePressed
; it improves the responsiveness of the game, as was observed in class.
Below are 2 screenshots, Fig. 1 is of a game that is in progress; Fig. 2 displays my message to a hapless player that just completed a game in more than 10 seconds.
Feel free to add helper methods to your classes that enhance their readability.
We will test your application by playing your game.
We expect your code to be on GitHub. Do not use turnin.
Possible Application Enhancements
- Make the number of critter in a game, & the critter size parameters that can change (e.g., settable by the user or as a level of difficult adjustment).
- Make more & better Critter subclasses.
- Make a Critter subclass that is an image.
- Introduce sound, especially when a click is made, giving different sounds when the click results in a hit vs. a miss.
- Introduce Critter subclasses where critters do not just go in a straight line (around the torus).
- Change the torus so that it is a verrtical cylinder. When a Critter attempts to go north of the north boundary, it reflects south (its y-delta changes sign). Ditto for critters attempting to go south of the south border.
- Other ideas?
Design Notes
- If you want to lift the Critter class (and its subclasses) to the top level, please feel free.
Rubric
Value | Aspect |
---|---|
1 | Compiles & executes. |
5 | All enhancements work as specified. |
1 | Javadoc is complete, generated, & adheres to Javadoc guidelines. |
3 | Style |
10 | Total |
For style, we want:
- Consistent application of some indentation policy
- Carefully chosen, meaningful identifier names
- Thoughtful comments, where needed, expressed in concise, precise English.
- Use of symbolic program constants in place of literals;
- Organization adheres to DRY principle.