import greenfoot.*;
public class mouse extends Actor
{
private Counter counter;
/**
* Act - do whatever the mouse wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public mouse(Counter pointCounter)
{
counter = pointCounter;
}
public void act()
{
moveAbout();
eat();
}
private void moveAbout()
{
if (Greenfoot.isKeyDown("right"))move(3);
turn(90);
if(Greenfoot.isKeyDown("down"))move(3);
turn(90);
if (Greenfoot.isKeyDown("left"))move(3);
turn(90);
if(Greenfoot.isKeyDown("up"))move(3);
turn(90);
}
private void eat()
{
Actor bread;
bread = getOneObjectAtOffset(0,0, bread.class);
if (bread != null);
World world;
world = getWorld();
world.removeObject(bread);
counter.add(1);
}
}

