|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.graphics.GObject acm.graphics.GTurtle Beast
public class Beast
A creature that lives in our simulated world. Creatures have a physical presence in the world but are guided by their brains and their packs.
Field Summary | |
---|---|
static int |
DEFAULT_SIZE
Default size of a beast, in pixels. |
static int |
DEFAULT_SPEED
Default distance to move in one step, in pixels. |
static java.awt.Color |
GROOVY_COLOR
Color when 100% groovy at full intensity. |
static java.awt.Color |
UNGROOVY_COLOR
Color when 100% ungroovy at full intensity. |
Constructor Summary | |
---|---|
Beast(IBeastBrain brain,
IPackFinder packFinder)
Construct a new beast with the given brain and packFinder. |
|
Beast(IBeastBrain brain,
IPackFinder packFinder,
double x,
double y,
BeastMood mood,
double speed)
Create a new beast with the given data. |
Method Summary | |
---|---|
void |
drawTurtle(java.awt.Graphics g)
New instructions on how to draw the beast. |
int |
getAge()
Fetch the beast's age |
IBeastBrain |
getBrain()
Fetch the beast's current brain. |
BeastInfo |
getInfo()
Fetch the beast's current info. |
BeastMood |
getMood()
Fetch the beast's current mood. |
IPackFinder |
getPackFinder()
Fetch the beast's current pack finder. |
void |
setBrain(IBeastBrain brain)
Set the beast's current brain. |
void |
setMood(BeastMood mood)
Set the beast's current mood. |
void |
setPackFinder(IPackFinder packFinder)
Set the beast's current pack finder. |
void |
update()
Update this beast to its next step. |
Methods inherited from class acm.graphics.GTurtle |
---|
contains, erasePath, forward, forward, getBounds, getDirection, getSpeed, getTurtleSize, hideTurtle, isPenDown, isTurtleVisible, left, main, move, paint, penDown, penUp, right, setColor, setDirection, setLocation, setSize, setSpeed, showTurtle |
Methods inherited from class acm.graphics.GObject |
---|
addActionListener, addMouseListener, addMouseMotionListener, contains, fireActionEvent, fireActionEvent, getColor, getHeight, getLocation, getParent, getSize, getWidth, getX, getY, isVisible, movePolar, pause, removeActionListener, removeMouseListener, removeMouseMotionListener, sendBackward, sendForward, sendToBack, sendToFront, setLocation, setVisible, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.awt.Color GROOVY_COLOR
public static final java.awt.Color UNGROOVY_COLOR
public static final int DEFAULT_SPEED
public static final int DEFAULT_SIZE
Constructor Detail |
---|
public Beast(IBeastBrain brain, IPackFinder packFinder)
brain
- a non-null brain to use for the beastpackFinder
- a non-null packFinder to use for the beastpublic Beast(IBeastBrain brain, IPackFinder packFinder, double x, double y, BeastMood mood, double speed)
brain
- the beast's brain (non-null)packFinder
- the beast's pack finder (non-null)x
- the beast's starting x positiony
- the beast's starting x positionmood
- the beast's mood (may be null for a default mood)speed
- the beast's speedMethod Detail |
---|
public IPackFinder getPackFinder()
public void setPackFinder(IPackFinder packFinder)
packFinder
- the new pack finder (non-null)public BeastInfo getInfo()
public int getAge()
public IBeastBrain getBrain()
public void setBrain(IBeastBrain brain)
brain
- the new brain (non-null)public BeastMood getMood()
public void setMood(BeastMood mood)
mood
- the new mood (may be null for default mood)public void update()
Note: remember that beast's MUST be supplied non-null brains and packFinders in their constructors. If either was null, the error is likely to show up here.
public void drawTurtle(java.awt.Graphics g)
drawTurtle
in class acm.graphics.GTurtle
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |