Programming Assignment 4
Date Due: November 8, 2000
Design and implement an applet that plays a game called Catch the Creature. Create a class that represents a creature that can be drawn on the screen at any particular location. Have the creature appear at a random location on the applet window for a random duration, then disappear and reappear somewhere else. The goal is to “catch” the creature by pressing the mouse button while the mouse pointer is on the creature image. Include in the creature class a method that determines if the location of the mouse click corresponds to the current location of the creature. Display an updated count of the number of times the creature is caught. Play an appropriate audio clip whenever the creature pops into another location, and another clip when the creature is “caught”.
You must at least do the following things for this program to receive full credit:
-The assignment must be an applet, not an application, with your class name being your lastnameCreature. For example, the first line of a program I did would be
public class kappersCreature extends Applet
-Your creature must be a .gif image that you create or find
on your computer somewhere. Be
sure to send me your .gif file. Rename
it to something with your name in it, like kappers.gif.
-Your applet must make a sound every time the creature
relocates itself, and a different sound every time -you “catch” the
creature. Catching the creature is
clicking anywhere in the .gif image, not just directly on the (x, y) location
of the image (that is really hard!). Be
sure to send me your .au files. Rename
them to something with your name in them, like kappers1.au and kappers2.au.
-You must implement MouseListener and ActionListener.
-Use constants for creature locations, timer delay, and anywhere else you find appropriate.
-Keep a score count as text somewhere on the applet, that increments each time you “catch” the creature. You can start your count at 0.
-Comment your code – name and SSN are a must!!
Be
sure to follow all instructions above to receive full credit! Also be sure to send me your .gif and .au
files or your code won’t compile on my machine. VERY IMPORTANT!!!! I
can’t grade code that doesn’t compile!!!
Note:
Depending
on the version of your web browser, the timer code may not work. Appletviewer should definitely work, though,
to see your program. Just type
appletviewer
kappersCreature.html
in
the DOS window once your code has compiled and you have made an html file. You can view it there instead of on a
webpage.
Turn in a hard copy (print out) of your program to me in class the night the program is due. You must also send your program to me electronically, to my email address (kathleen@cs.ucf.edu). The subject line of your program should be Assignment #4 – emails without this subject will be returned. This is so I can distinguish them from questions you may have. You will be emailing me your .java file, a .html file, and any .gif and .au files you use for images and sounds, so that I can compile and run them it my own. Do NOT just send me an html file or a url link – I need to be able to compile your code.
Be sure to name your class, your .java file, and your .html file all the same name as your lastnameCreature!!