This is a line 6, not line 4. Let me show you the new 'lookForCrab' method now:
// the Lobster class 'lookForCrab' method
public void lookForCrab()
{
Crab crab = (Crab)getOneObjectAtOffset(0, 0, Crab.class); // this line gives more play area for crab around the lobster
if (crab == null) return;
if (crab.isPoweredUp()) // this line ensures the powered-up crab is not eaten by lobster
{
getWorld().removeObject(this);
return;
}
getWorld().removeObject(crab);
Greenfoot.playSound("au.wav");
Greenfoot.stop();
}

