Main Page   Packages   Alphabetical List   Compound List   File List   Compound Members  

GhostActor Class Reference

List of all members.

Detailed Description

Represents a ghost on the game board.


Public Member Functions

 GhostActor (GridNode startingPosition, PacmanActor target)
 Constructor for this GhostActor.

GridNode getNode ()
 Added by Benson Fung (for killing pacman).

void advanceFrame ()
 Called to advance the logic of the game one frame.

void paint (Graphics g)
 Paints the GhostActor.

int getX ()
 Returns the current x coordinate of the ghost.

int getY ()
 Returns the current y coordinate of the ghost.

void restart ()

Static Public Member Functions

void setRunFromPac (boolean b)
 Sets when all ghosts should run from pacman.


Static Public Attributes

final int NONE = 0
 Enum for a desired dirrection.

final int UP = 1
 Enum for a desired dirrection.

final int DOWN = 2
 Enum for a desired dirrection.

final int LEFT = 3
 Enum for a desired dirrection.

final int RIGHT = 4
 Enum for a desired dirrection.


Private Member Functions

void moveTowards (int i1, int i2, int i3, int i4)
 Tries to move the ghost in these directions.

boolean goInDirection (int d)
 Tries to start moving in the specified dirrection.

boolean goToNode (GridNode n)

Private Attributes

GridNode myNode_
 The node where this ghost currently resides.

GridNode resetNode_
 This is the start node and where the ghost goes back to if pacman is killed.

PacmanActor target_
 The pacman which this ghost is chasing (or running from).

int pixelX_
 current X Pixel coord of this actor

int pixelY_
 current Y Pixel coord of this actor

int newPixelX_
 destination X Pixel coord for this actor

int newPixelY_
 destination Y Pixel coord for this actor


Static Private Attributes

boolean runFromPac_
 This value is true if the ghosts should run from pacman.


Constructor & Destructor Documentation

GhostActor.GhostActor GridNode  startingPosition,
PacmanActor  target
 

Constructor for this GhostActor.

Parameters:
startingPosition the GridNode where this ghosts begins the game
target the PacmanActor this ghost should chase or run from.


Member Function Documentation

void GhostActor.advanceFrame  ) 
 

Called to advance the logic of the game one frame.

GridNode GhostActor.getNode  ) 
 

Added by Benson Fung (for killing pacman).

Returns:
the current node where this ghost resides

int GhostActor.getX  ) 
 

Returns the current x coordinate of the ghost.

int GhostActor.getY  ) 
 

Returns the current y coordinate of the ghost.

boolean GhostActor.goInDirection int  d  )  [private]
 

Tries to start moving in the specified dirrection.

Parameters:
d desired dirrection in which to move
Returns:
true if we can go in this dirrection

boolean GhostActor.goToNode GridNode  n  )  [private]
 

Parameters:
n Goes to this node if it is not null
Returns:
true when it's possible to go to the node

void GhostActor.moveTowards int  i1,
int  i2,
int  i3,
int  i4
[private]
 

Tries to move the ghost in these directions.

The first one is most favorable.

Parameters:
i1 First most desierable choice
i2 Second most desierable choice
i3 Third most desierable choice
i4 Fourth most desierable choice

void GhostActor.paint Graphics  g  ) 
 

Paints the GhostActor.

Parameters:
g Graphics object where drawing should take place.

void GhostActor.restart  ) 
 

void GhostActor.setRunFromPac boolean  b  )  [static]
 

Sets when all ghosts should run from pacman.


Member Data Documentation

final int GhostActor.DOWN = 2 [static]
 

Enum for a desired dirrection.

final int GhostActor.LEFT = 3 [static]
 

Enum for a desired dirrection.

GridNode GhostActor.myNode_ [private]
 

The node where this ghost currently resides.

int GhostActor.newPixelX_ [private]
 

destination X Pixel coord for this actor

int GhostActor.newPixelY_ [private]
 

destination Y Pixel coord for this actor

final int GhostActor.NONE = 0 [static]
 

Enum for a desired dirrection.

int GhostActor.pixelX_ [private]
 

current X Pixel coord of this actor

int GhostActor.pixelY_ [private]
 

current Y Pixel coord of this actor

GridNode GhostActor.resetNode_ [private]
 

This is the start node and where the ghost goes back to if pacman is killed.

final int GhostActor.RIGHT = 4 [static]
 

Enum for a desired dirrection.

boolean GhostActor.runFromPac_ [static, private]
 

This value is true if the ghosts should run from pacman.

PacmanActor GhostActor.target_ [private]
 

The pacman which this ghost is chasing (or running from).

final int GhostActor.UP = 1 [static]
 

Enum for a desired dirrection.


The documentation for this class was generated from the following file:
Generated on Tue May 13 00:53:02 2003 for PACMAN by doxygen1.3