java.lang.Objectgreenfoot.Actor
Creature
public abstract class Creature
A Creature is the base class for all alien beings in this scenario. It provides the basic abilities of creatures in this world.
Constructor Summary | |
---|---|
Creature()
|
Method Summary | |
---|---|
boolean |
atWater()
Return true if we have just seen water in front of us. |
boolean |
atWorldEdge()
Test if we are close to one of the edges of the world. |
boolean |
carryingTomato()
Check whether we are carrying a tomato. |
abstract java.lang.String |
getCurrentImage()
This method must be defined in subclasses. |
void |
loadTomato()
Load a tomato onto *another* creature. |
void |
move()
Move forward roughly in the current direction. |
protected boolean |
randomChance(int percent)
Return 'true' in exactly 'percent' number of calls. |
boolean |
removeTomato()
Remove the tomato currently carried (and return true). |
void |
turn(int angle)
Turn 'angle' degrees towards the right (clockwise). |
Methods inherited from class greenfoot.Actor |
---|
act, addedToWorld, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getX, getY, intersects, setImage, setImage, setLocation, setRotation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Creature()
Method Detail |
---|
public boolean atWater()
public boolean atWorldEdge()
public final boolean carryingTomato()
public abstract java.lang.String getCurrentImage()
public final void loadTomato()
public void move()
protected boolean randomChance(int percent)
public final boolean removeTomato()
public void turn(int angle)