import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Shark here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Shark extends Actor
{
/**
* Act - do whatever the Shark wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(-4);
if (Greenfoot.isKeyDown("Left"))
{
turn(-3);
}
if (Greenfoot.isKeyDown("Right"))
{
turn(3);
}
Actor Fish;
Fish = getOneObjectAtOffset(0,0,Fish.class);
if(Fish!=null)
{
Water thehouse = (Water)getWorld();
thehouse.removeObject(Fish);
Counter counter = thehouse.getCounter();
counter.bumpCount(1);
}
}
}
