I have managed to increment the score in Level1_A, but how do I get it to increment from the last number in Level1_B? My scenario is located here: http://www.greenfoot.org/scenarios/8881
public class Levels extends World
{
protected static Counter scoreCounter;
protected static Counter lifeCounter;
/**
* Constructor for objects of class Levels.
*
*/
public Levels()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1110, 590, 1, false);
scoreCounter = new Counter ("Score");
lifeCounter = new Counter ("Life");
lifeCounter.setValue(3);
}
public static Counter getScoreCounter()
{
return scoreCounter;
}
public Counter getLifeCounter()
{
return lifeCounter;
}
}public class Level1_A extends Levels
{
/**
* Constructor for objects of class Level1_A.
*
*/
public Level1_A()
{
Greenfoot.setSpeed(50);
worldColor();
populateWorld();
}
public void populateWorld()
{
addObject(scoreCounter, 1035, 21);
addObject(lifeCounter, 1027, 51); public Level1_B()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
Greenfoot.setSpeed(50);
Greenfoot.start();
worldColor();
populateWorld();
}
public void populateWorld()
{
scoreCounter.setValue(Level1_A.scoreCounter.getValue());
addObject(scoreCounter, 1035, 21);
addObject(lifeCounter, 1027, 51);public Levels()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1110, 590, 1, false);
scoreCounter = new Counter ("Score");
lifeCounter = new Counter ("Life");
lifeCounter.setValue(3);
} public void act()
{
List Mario = getObjects(Mario.class);
if ()
{
setupLevel(level+1);
}
}
public void act()
{
List mario = getObjectsAt(goal.x, goal.y, Mario.class);
if (!mario.isEmpty())
{
setupLevel(level+1);
}
}public Goal(int width, int height)
{
setImage(new GreenfootImage(width, height));
}if (!(Actor)(mario.get(0)).getOneIntersectingObject(Goal.class).isEmpty())
public boolean isAtGoal()
{
Goal goal = (Goal)getOneIntersectingObject(Goal.class);
if (goal != null)
{
return true;
}
return false;
} public void act()
{
List mario = getObjects(Mario.class);
if (!mario.isEmpty())
{
if (((Mario)(mario.get(0))).isAtGoal())
{
//Mario is at the goal
}
}
}