|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Robot
The robot class represents an individual robot that is active on a level at any given time. A different robot should be created for each player in the game.
Constructor Summary | |
Robot(java.lang.String userName,
int robotNum)
Creates a new Robot object of the given color at the given position and sets all other variables to their initial conditions. |
Method Summary | |
void |
addMove(Move mv)
Adds the inputed move to the Robot's moveTracker and adjusts the robots location. |
int |
calcScore(int time)
Calculates and returns the score. |
boolean |
getChangeLevelFlag()
Returns the changeLevel flag for the robot signifying if the user wants to change the level or not. |
int |
getCol()
Returns the current column location of the robot. |
RobotColor |
getColor()
Returns the current color of the robot |
int |
getCratesIncinerated()
Returns the number of crates that have been incinerated by this robot in the current game. |
Direction |
getDirectionFaced()
Returns the direction that the robot is facing in the current game. |
int |
getMoves()
Returns the number of moves that have been taken by this robot in the current game. |
Move[] |
getMoveTracker()
Returns an array of the moves within the MoveTracker |
int |
getPushes()
Returns the number of pushes that this robot has done in the current game. |
boolean |
getRestartFlag()
Returns the restart flag for the robot signifying if the user wants to restart the level or not. |
int |
getRobotNumber()
Returns which robot this is. |
int |
getRow()
Returns the current row location of the robot. |
int |
getScore()
Returns the current score associated with this robot. |
java.lang.String |
getUserName()
Returns the user name of the robot. |
Move |
removeMove()
Removes a move from the moveTracker Vector. |
void |
resetCratesIncinerated()
Sets the number of crates that the robot has incinerated. |
void |
resetMoveTracker()
Resets the moveTracker to an empty value. |
void |
resetPushes()
Sets the number of moves that the robot has taken. |
void |
setChangeLevelFlag(boolean flag)
Sets the changeLevel flag for the robot. |
void |
setCol(int column)
Sets the current column location of the robot. |
void |
setColor(RobotColor color)
Sets the current color of the robot. |
void |
setNextColor()
Returns the next color in the color order: blue, red, green and yellow. |
void |
setRestartFlag(boolean flag)
Sets the restart flag for the robot. |
void |
setRow(int row)
Sets the current row location of the robot. |
void |
setUserName(java.lang.String name)
Sets the user name of the robot. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Robot(java.lang.String userName, int robotNum)
userName
- the name of the robotrobotNum
- The number of the robotMethod Detail |
public RobotColor getColor()
public void setColor(RobotColor color)
color
- The new int value for color.public int getRobotNumber()
public int getRow()
public void setRow(int row)
row
- The new int value representing the row locationpublic int getCol()
public void setCol(int column)
column
- The int value representing the column locationpublic void addMove(Move mv)
mv
- The move to be added to the vectorblocked
- true if the robot is blocked, otherwise false
public Move removeMove()
public void resetMoveTracker()
public Move[] getMoveTracker()
public int getMoves()
public int getScore()
public int calcScore(int time)
time
- Total time has elapsed
public int getPushes()
public void resetPushes()
pushes
- The new number of pushes donepublic int getCratesIncinerated()
public void resetCratesIncinerated()
crates
- The new number of crates that the robot has incineratedpublic void setNextColor()
public java.lang.String getUserName()
public void setUserName(java.lang.String name)
name
- the new user name for this robotpublic Direction getDirectionFaced()
public boolean getRestartFlag()
public void setRestartFlag(boolean flag)
flag
- the flag signifying if the robot wants to restart the
level or notpublic boolean getChangeLevelFlag()
public void setChangeLevelFlag(boolean flag)
flag
- the flag signifying if the robot wants to change the
level or not
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |