|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.collegeboard.gridworld.actor.Actor
public class Actor
| Constructor Summary | |
|---|---|
Actor()
Constructs a black actor that is facing north. |
|
| Method Summary | |
|---|---|
void |
act()
Override this method if your actor needs to carry out an action. |
Color |
getColor()
Gets the color of this actor. |
int |
getDirection()
Gets the current direction of this actor. |
Grid<Actor> |
getGrid()
Gets the grid in which this actor is located |
Location |
getLocation()
Gets the location of this actor Precondition: This actor is in a grid |
void |
moveTo(Location newLocation)
Moves this actor to a new location. |
void |
putInGrid(Grid<Actor> gr,
Location loc)
Puts this actor into a grid. |
void |
removeFromGrid()
Removes an actor from a grid. |
void |
setColor(Color newColor)
Sets the color of this actor. |
String |
toString()
|
void |
turn(int angle)
Turns the direction of this actor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Actor()
| Method Detail |
|---|
public Location getLocation()
public Grid<Actor> getGrid()
public void putInGrid(Grid<Actor> gr,
Location loc)
gr - the grid into which this actor should be placedloc - the location into which the actor should be placed (must be valid)public void removeFromGrid()
public void moveTo(Location newLocation)
newLocation - the new location (must be valid)public void act()
public void turn(int angle)
angle - the angle (clockwise) by which to turnpublic int getDirection()
public Color getColor()
public void setColor(Color newColor)
newColor - the new colorpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||