Class Eyes
java.lang.Object
|
+----Sprite
|
+----Eyes
- public class Eyes
- extends Sprite
This is the class of the "Eyes" object - creatures that move
back and forth in the game. This class extends the "Sprite"
class. It sets the initial location and behavior of the "eyes"
bitmaps in the game. It also initializes the eye images.
This class overrides the Sprite class "update" and "incframe"
methods.
-
blinkDelay
- "Eye" blink rate and trigger variables
-
blinkTrigger
- "Eye" blink rate and trigger variables
-
image
- "Eye" image frame array
-
rand
- Random number generator
-
Eyes(Component, int, int, int)
- Eye class constructor method - set eye initial location
and "blink" rate.
-
incFrame()
- Increment image frames and set frames to synchronize
with the "blink" delay.
-
initResources(Applet, MediaTracker, int)
- Initialize Resources - get bitmap images and synchronize with
the Media Tracker.
-
setCollision()
- Set the collision boundary rectangle for the image.
-
update()
- See if the "Eye" bitmap image escaped the screen.
image
protected static Image image[][]
- "Eye" image frame array
blinkDelay
protected int blinkDelay
- "Eye" blink rate and trigger variables
blinkTrigger
protected int blinkTrigger
- "Eye" blink rate and trigger variables
rand
private static Random rand
- Random number generator
Eyes
public Eyes(Component comp,
int dir,
int speedInc,
int bd)
- Eye class constructor method - set eye initial location
and "blink" rate.
initResources
public static void initResources(Applet app,
MediaTracker tracker,
int id)
- Initialize Resources - get bitmap images and synchronize with
the Media Tracker.
setCollision
protected void setCollision()
- Set the collision boundary rectangle for the image. Also
used for determining coordinates for the isPointInside()
method in the Sprite class.
- Overrides:
- setCollision in class Sprite
update
public BitSet update()
- See if the "Eye" bitmap image escaped the screen. ***This
will increment the "lost" counter in the NightHunter class.
This is not A very object oriented like approach.
- Overrides:
- update in class Sprite
incFrame
protected void incFrame()
- Increment image frames and set frames to synchronize
with the "blink" delay.
- Overrides:
- incFrame in class Sprite