|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Observable | +--Map
The Map class represents the environment in which the robot will be able to move around in. It will hold the location of crates, walls, incinerators, & robots.
Field Summary | |
protected Level |
level
The name of the level. |
protected boolean |
loading
The boolean to let sounds know if the game is loading or not |
protected java.util.Vector |
robots
The robots is a Vector of up to 4 robots to represent each of the players in multiplayer mode. |
Constructor Summary | |
Map(Game owner)
Creates a new Map object with given coordinates of crates, walls and incinerators. |
Method Summary | |
void |
addRobot(Robot robot)
Adds a Robot to the robot vector. |
int |
calculateScore(int robot)
An algorithm will compute a score using a combination of game variables. |
void |
changeLevel(java.lang.String newlevel)
Player choses a different level map to play. |
Square[][] |
getMap()
Returns a 2-dimensional array containing the Squares representing the current map. |
Robot |
getRobot(int robotNum)
Removes the Robot with a robotNumber equal to the passed robotNum from the robot vector. |
Robot[] |
getRobots()
Returns an array of the Robots on the map. |
int |
getTime()
Returns the current time spent solving the map in seconds. |
void |
instantReplay()
Shows the sequence of movements a robot has taken up to the current point in the level. |
boolean |
isPaused()
Returns true if the map is currently paused, false otherwise. |
void |
moveRobot(int robotNum,
Direction direction)
Moves the robot in the direction passed. |
void |
pauseTimer()
Pauses the timer. |
void |
removeRobot(int robot)
Removes the Robot with a robotNumber equal to the passed robotNum from the robot list. |
void |
restartLevel()
Current level is reset. |
void |
setTimer(int newTime)
Sets the timer to the value passed. |
void |
startTimer()
Starts the timer. |
java.lang.String[] |
toStringArray()
Returns a 2-dimensional array containing the values representing the current map. |
void |
undoMove(int robotNum)
Updates the board to reflect the state before the robot's last move. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Level level
protected java.util.Vector robots
protected boolean loading
Constructor Detail |
public Map(Game owner)
Method Detail |
public void moveRobot(int robotNum, Direction direction)
robotNum
- the robot to movedir
- the direction to move
public void addRobot(Robot robot)
robot
- the robot to be added to the robot vector
public void removeRobot(int robot)
robot
- the robot number to be removed from the robot vector
public Robot getRobot(int robotNum)
robotNum
- the robot number to be found in the robots vectorpublic void restartLevel()
public void instantReplay()
public void changeLevel(java.lang.String newlevel)
level
- String value associated with name of the level
public int calculateScore(int robot)
robot
- int value associated with player's robot
public void pauseTimer()
public void startTimer()
public void setTimer(int newTime)
public boolean isPaused()
public void undoMove(int robotNum)
robotNum
- the robot number who performed the undo
public java.lang.String[] toStringArray()
Returns a 2-dimensional array containing the values representing the current map.
public Square[][] getMap()
Returns a 2-dimensional array containing the Squares representing the current map.
public Robot[] getRobots()
Returns an array of the Robots on the map.
public int getTime()
Returns the current time spent solving the map in seconds.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |