first commit
This commit is contained in:
105
CS1322/p6/MyWay2/CNode.java
Normal file
105
CS1322/p6/MyWay2/CNode.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* <PRE>
|
||||
* CNode.java
|
||||
*
|
||||
* Revisions: 1.0 Nov. 17, 2002
|
||||
* Created the CNode class
|
||||
* 1.1 Nov. 17, 2002
|
||||
* Added Primary code, Commented, Finished
|
||||
*
|
||||
* </PRE>
|
||||
*
|
||||
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
||||
* @version Version 1.1, Nov. 17, 2002
|
||||
*/
|
||||
|
||||
/**
|
||||
*The Engine class (CEngine) can take in a board and turn it into a game map.
|
||||
*The Engine class then creates another grid which will below the game map
|
||||
* that holds the nodes for the Intelligence class (CIntelligence).
|
||||
*The Node classes hold the data for where a ghost can move and are used to
|
||||
* send ghosts after the player. If pacman is between Node A and Node B and
|
||||
* a ghost finds itself in Node A, it will turn and head in the direction of
|
||||
* Node B. These Intelligence specifics are handled in the
|
||||
* CIntelligence->CIntelGhost class
|
||||
*/
|
||||
public class CNode extends CCoord{
|
||||
|
||||
/**
|
||||
*Define where the ghost can move when at this node
|
||||
*/
|
||||
private boolean MV_LEFT;
|
||||
private boolean MV_RIGHT;
|
||||
private boolean MV_UP;
|
||||
private boolean MV_DN;
|
||||
//originally meant to genarilize code to allow increase height nodes
|
||||
//but removed due to deadline constraints
|
||||
//mmm, deadlines....mmmm
|
||||
//private boolean INC_HEIGHT;
|
||||
|
||||
///////////////
|
||||
//Constructor//
|
||||
///////////////
|
||||
|
||||
/**
|
||||
*@param up, can move up?
|
||||
*@param down, can move down?
|
||||
*@param left, can move left?
|
||||
*@param right, can move right?
|
||||
*@param x, x-coord
|
||||
*@param y, y-coord
|
||||
*@param h, h-coord
|
||||
*/
|
||||
public CNode(boolean up, boolean down, boolean left, boolean right,
|
||||
/*boolean incH,*/ int x, int y, int h){
|
||||
super(x,y,h);
|
||||
MV_UP = up;
|
||||
MV_DN = down;
|
||||
MV_LEFT = left;
|
||||
MV_RIGHT = right;
|
||||
//INC_HEIGHT = incH;
|
||||
}
|
||||
|
||||
///////////
|
||||
//Methods//
|
||||
///////////
|
||||
|
||||
/**
|
||||
*@return true if can go up from node
|
||||
*/
|
||||
public boolean canMV_UP(){
|
||||
return MV_UP;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return true if can go down from node
|
||||
*/
|
||||
public boolean canMV_DN(){
|
||||
return MV_DN;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return true if can move left from node
|
||||
*/
|
||||
public boolean canMV_LEFT(){
|
||||
return MV_LEFT;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return true if can move right
|
||||
*/
|
||||
public boolean canMV_RIGHT(){
|
||||
return MV_RIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return Coordinates of the Node
|
||||
*/
|
||||
public CCoord getNodeCoord(){
|
||||
return (new CCoord(this.getX(), this.getY(), this.getZ()));
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return (super.toString() + MV_UP+MV_DN+MV_LEFT+MV_RIGHT+"*/");
|
||||
}
|
||||
}// end of class CNode
|
||||
Reference in New Issue
Block a user