|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.collegeboard.gridworld.actor.Actor
com.collegeboard.gridworld.actor.Bug
public class Bug
A bug is an actor that can move and turn. It drops flowers as it moves. Override a bug to draw shapes in the actor world.
copyright© 2005 Cay S. Horstmann (http://horstmann.com)
| Constructor Summary | |
|---|---|
Bug()
Constructs a red bug. |
|
Bug(Color color)
Constructs a bug of a given color. |
|
| Method Summary | |
|---|---|
void |
act()
Override this method to define the action of this actor. |
boolean |
canMove()
Tests whether this bug can move forward. |
void |
move()
Moves this bug forward. |
void |
turn()
Makes this bug turn by 45 degrees to the right. |
| Methods inherited from class com.collegeboard.gridworld.actor.Actor |
|---|
getColor, getDirection, getGrid, getLocation, moveTo, putSelfInGrid, removeSelfFromGrid, setColor, setDirection, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Bug()
public Bug(Color color)
color - the color for this bug| Method Detail |
|---|
public void act()
Actor
act in class Actorpublic void turn()
public void move()
public boolean canMove()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||