public class Bug extends Actor
Bug
is an actor that can move and turn. It drops flowers as
it moves. Constructor and Description |
---|
Bug()
Constructs a red bug.
|
Bug(java.awt.Color bugColor)
Constructs a bug of a given color.
|
Modifier and Type | Method and Description |
---|---|
void |
act()
Moves if it can move, turns otherwise.
|
boolean |
canMove()
Tests whether this bug can move forward into a location that is empty or
contains a flower.
|
void |
move()
Moves the bug forward, putting a flower into the location it previously
occupied.
|
void |
turn()
Turns the bug 45 degrees to the right without changing its location.
|
getColor, getDirection, getGrid, getLocation, moveTo, putSelfInGrid, removeSelfFromGrid, setColor, setDirection, toString
public Bug()
public Bug(java.awt.Color bugColor)
bugColor
- the color for this bugpublic void turn()
public void move()
public boolean canMove()