com.collegeboard.gridworld.actor
Class Critter
java.lang.Object
com.collegeboard.gridworld.actor.Actor
com.collegeboard.gridworld.actor.Critter
public class Critter
- extends Actor
|
Constructor Summary |
Critter()
Constructs a green critter that drops flowers as it moves. |
Critter(Color color)
Constructs a critter of a given color that drops flowers as it moves. |
| Methods inherited from class com.collegeboard.gridworld.actor.Actor |
act, getColor, getDirection, getGrid, getLocation, getNeighbors, processNeighbors, putSelfInGrid, removeSelfFromGrid, setColor, toString, turnBy |
Critter
public Critter()
- Constructs a green critter that drops flowers as it moves.
Critter
public Critter(Color color)
- Constructs a critter of a given color that drops flowers as it moves.
- Parameters:
color - the color for this critter
getNextLocation
public Location getNextLocation()
- Overrides:
getNextLocation in class Actor
moveTo
public void moveTo(Location next)
- Description copied from class:
Actor
- Moves this actor to a new location. If there is another actor at the given location, it is removed.
Precondition: This actor has been put in a grid
- Overrides:
moveTo in class Actor
- Parameters:
next - the new location (must be valid)
turn
public void turn()
- Makes this critter turn by 45 degrees to the right.
move
public void move()