java.lang.Objectgreenfoot.Actor
Animal
public class Animal
Animal. This is the base class for all animals. In addition to the standard Actor methods, it provides the ability to move and turn.
| Constructor Summary | |
|---|---|
Animal()
Constructor for Animal - nothing to do. |
|
| Method Summary | |
|---|---|
void |
act()
Act - empty method. |
boolean |
atWorldEdge()
Test if we are close to one of the edges of the world. |
boolean |
canSee(java.lang.Class clss)
Return true if we can see an object of class 'clss' right where we are. |
void |
eat(java.lang.Class clss)
Try to eat an object of class 'clss'. |
void |
move()
Move forward in the current direction. |
void |
turn(int angle)
Turn 'angle' degrees towards the right (clockwise). |
| Methods inherited from class greenfoot.Actor |
|---|
addedToWorld, getHeight, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWidth, 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 Animal()
| Method Detail |
|---|
public void act()
act in class greenfoot.Actorpublic boolean atWorldEdge()
public boolean canSee(java.lang.Class clss)
public void eat(java.lang.Class clss)
public void move()
public void turn(int angle)