What are the goals for each level? Level 1 is 50. Level 2 = 70. Level 3 = ? etc?
// class fields
static int level = 0; // to track the level
static int[] goal = { 50, 80, 100 }; // to specify goal at each level
// in the act after 'eatLeaves'
if (leavesEaten == goal[level])
{
level = level + 1;
if (level == goal.length) // are all levels complete
{
Greenfoot.stop();
return;
}
else
{
Greenfoot.setWorld(new MainWorld());
return;
}
}if (Wombat.level == 0)
{
// add whatever
}
else if (Wombat.level == 1)
{
// add whatever
}
else if (Wombat.level == 2)
{
// add whatever
}public World2(Wombat wombat)
{
super(12, 12, 50); // or whatever size
addObject(wombat, x, y); // replace x and y with values
// add all the other objects
}if (leavesEaten == 50) Greenfoot.setWorld(new World2()); else if (leavesEaten == 130) Greenfoot.setWorld(new World3()); else if (leavesEaten == 230) Greenfoot.stop();