Class Crab

java.lang.Object
  extended by greenfoot.Actor
      extended by Animal
          extended by Crab

public class Crab
extends Animal

This class defines a crab. Crabs live on the beach. They like sand worms (very yummy, especially the green ones). Version: 3 In this version, the crab is controlled by the keyboard. It still eats worms if it finds any, of course.


Constructor Summary
Crab()
           
 
Method Summary
 void act()
          Act - do whatever the crab wants to do.
 void lookForWorm()
          Try to eat a worm.
 
Methods inherited from class Animal
atWorldEdge, getCrabWorld, move, turn
 
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

Crab

public Crab()
Method Detail

act

public void act()
Act - do whatever the crab wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.

Overrides:
act in class Animal

lookForWorm

public void lookForWorm()
Try to eat a worm. That is: check whether we have stumbled upon a worm. If we have, eat it. If not, ahh, well, maybe next time.