I could not find any shark images in the images folder of the scenario. Maybe you mis-copied it
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
{
private Platform platform = null;
public void act()
{
move();
Schip s = (Schip)getOneIntersectingObject(Schip.class);
if (schip != null)
{
removeLive();
}
}
public void move()
{
move(5);
Platform p = (Platform)getOneIntersectingObject(Platform.class);
if (getX() <= 5 || getX() >= getWorld().getWidth() - 5)
{
turn(180);
}
if (getY() <= 5 || getY() >= getWorld().getHeight() - 5)
{
turn(180);
}
}
private Schip schip = null;
public void setSchip(Schip s)
{
schip = s;
}
public Schip getSchip()
{
return schip;
}
public void removeLive()
{
int lives = getWorld().getObjects(Lives.class).size();
getWorld().removeObject((Actor)getWorld().getObjects(Lives.class).get(lives-1));
if (lives != 1)
{
//Only does the following, if it was the not the last last life
Greenfoot.playSound("lose life.wav");
}
else
{
//Only does the following, if it was the last life.
Greenfoot.playSound("game over.wav");
Greenfoot.stop();
}
}
}
public void act()
{
lifecounter--;
}
public void act()
{
lifecounter--;
move();
Schip s = (Schip)getOneIntersectingObject(Schip.class);
if (s != null && lifecounter <= 0)
{
removeLive();
lifecounter = 100;
}
} Schip s = (Schip)getOneIntersectingObject(Schip.class);
if (s != null && lifecounter <= 0)
{
removeLive();
lifecounter = 100;
}