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.


Variable Index

 o blinkDelay
"Eye" blink rate and trigger variables
 o blinkTrigger
"Eye" blink rate and trigger variables
 o image
"Eye" image frame array
 o rand
Random number generator

Constructor Index

 o Eyes(Component, int, int, int)
Eye class constructor method - set eye initial location and "blink" rate.

Method Index

 o incFrame()
Increment image frames and set frames to synchronize with the "blink" delay.
 o initResources(Applet, MediaTracker, int)
Initialize Resources - get bitmap images and synchronize with the Media Tracker.
 o setCollision()
Set the collision boundary rectangle for the image.
 o update()
See if the "Eye" bitmap image escaped the screen.

Variables

 o image
 protected static Image image[][]
"Eye" image frame array

 o blinkDelay
 protected int blinkDelay
"Eye" blink rate and trigger variables

 o blinkTrigger
 protected int blinkTrigger
"Eye" blink rate and trigger variables

 o rand
 private static Random rand
Random number generator

Constructors

 o Eyes
 public Eyes(Component comp,
             int dir,
             int speedInc,
             int bd)
Eye class constructor method - set eye initial location and "blink" rate.

Methods

 o initResources
 public static void initResources(Applet app,
                                  MediaTracker tracker,
                                  int id)
Initialize Resources - get bitmap images and synchronize with the Media Tracker.

 o 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
 o 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
 o incFrame
 protected void incFrame()
Increment image frames and set frames to synchronize with the "blink" delay.

Overrides:
incFrame in class Sprite