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
 void act()
          Override this method with the action that your actor carries out.actor needs to
 boolean canMove()
          Checks whether this critter can move in the current direction.
 void move()
          Moves in the current direction.
 void setTracing(boolean b)
           
 void turn()
          Turns 45 degrees to the right.
 
Methods inherited from class com.collegeboard.gridworld.actor.Actor
getColor, getDirection, getGrid, getLocation, getValidNeighborLocations, moveTo, putSelfInGrid, removeSelfFromGrid, setColor, toString, turn
 
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

act

public void act()
Description copied from class: Actor
Override this method with the action that your actor carries out.actor needs to

Specified by:
act in class Actor

turn

public void turn()
Turns 45 degrees to the right.


move

public void move()
Moves in the current direction. If tracing is turned on, drops a flower in the old location.


canMove

public boolean canMove()
Checks whether this critter can move in the current direction.

Returns:
true if the critter can move, false if the next location is invalid or occupied by an actor other than a flower

setTracing

public void setTracing(boolean b)