Hillary's Skeet Shoot
NOTE: For some reason my project is
not working in Netscape.
Please use Internet Explorer or Applet Viewer instead.
The first lady is pretty handy with that gun. The past couple months at
the White House have gotten her just a little bit peeved. Of course, she
can't let the American people know that she is upset, so a little bit of
behind-the-scenes venting is in order. It was time to go out to Camp
David and relax...
With a crack, Monica Lewinsky's new makeover is splattered to kingdom
come - after a second Bill's smug mug follows. Kenneth Starr better watch
out, I think he's next.
GOAL OF THE GAME: Shoot as many of the pictures as you can by
clicking your mouse on them. They should burst into flames when hit. Your
score is recorded in the upper left corner.
Although this game is humorous in nature, it is used to demonstrate
some of the concepts learned in 6.837, Computer Graphics. The primary objective
was to create a Sprite class which could be drawn onto a Playfield.
The Sprite class was then extended by an AnimatedSprite class, which incorporated
movement. We were required to implement transparent pixels and clipping,
which are both demonstrated by the flying skeets. We also check whether
a given coordinate contains a non-transparent sprite pixel when calculating
whether a click of the mouse hits a skeet.
I had hoped to add alpha channels, which would have let us do awesome
transparency effects, but I ran out of time. I might extend this
project further independent of the class.
I originally separated the Java files into two distinct packages, one
containing the core Sprite classes and another containing the Hillary skeet-shooting
game which used the core classes, but unfortunately browsers such as Netscape
and Internet Explorer have serious problems when displaying applets in
packages. No packages were used for this version of the code:
-
HillaryApplet.java
-
The main applet for our game.
-
Playfield.java
-
This class is a background on which Sprites and AnimatedSprites can draw
themselves.
-
AnimatedSprite.java
-
This is the animated version of a Sprite, which contains tracks (sequences)
of states to be cycled through. The track and state number on a given track
can be changed via public methods. This is primarily how the applet affected
output to the screen.
-
AnimState.java
-
Class which contains information relavent to a single animation state on
a track. The most important part of this is probably what Image to display.
-
AnimTrack.java
-
A sequence of AnimStates in a specified order.
-
Sprite.java
-
A Raster class that can be drawn on a Playfield.
-
Raster.java
-
A class which contains an array of pixel values. These can then be
converted into an Image and outputted to the screen. All of the graphical
objects above inherit from this.
-
Timed.java
-
A simple interface which says an object can be timed by a Timer.
-
Timer.java
-
A thread which periodically awakens and calls the tick method in an object
that implements Timed. The sleep interval is variable.
The images came from the following sources: The background was created
using Fractal Design Painter. The
pictures of Monica, Bill and Kenneth Starr were grabbed from the CNN
home page. The gun, if you haven't already guessed, is from Quake II
by ID Software. All the touching
up of these was done in Adobe Photoshop or Fractal Design Painter.