How can I make a new bonus world if all the lettuces in the main menu have been eaten? Here is my code but it isn't working.
public void seeEatLettuce()
{
if (canSee(Lettuce.class))
{
eat(Lettuce.class);
Greenfoot.playSound("slurp.wav");
lettucesEaten = lettucesEaten + 1;
if (lettucesEaten == 5)
{
createNewLettuce();
Greenfoot.setWorld(new Moon());
}
}
}

