com.collegeboard.gridworld.actor
Class Critter

java.lang.Object
  extended by com.collegeboard.gridworld.actor.Actor
      extended by 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.
 
Method Summary
 Location getNextLocation()
           
 void move()
           
 void moveTo(Location next)
          Moves this actor to a new location.
 void turn()
          Makes this critter turn by 45 degrees to the right.
 
Methods inherited from class com.collegeboard.gridworld.actor.Actor
act, getColor, getDirection, getGrid, getLocation, getNeighbors, processNeighbors, putSelfInGrid, removeSelfFromGrid, setColor, toString, turnBy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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
Method Detail

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()