public class PBear extends Actor
{
/**
* Act - do whatever the Rocket wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
moveAndTurn();
eat();
}
public void moveAndTurn()
{
move(4);
if (Greenfoot.isKeyDown("A"))
{
turn(-3);
}
if (Greenfoot.isKeyDown("D"))
{
turn(3);
}
}
public void eat()
{
Actor GFish;
GFish = getOneObjectAtOffset(0,0, GFish.class);
if ( GFish != null)
{
World world;
world = getWorld();
world.removeObject( GFish);
}
}
}
