How do I use a counter to change levels. I want to add 1 to the counter at the end of each level. When the counter = 1, level 2 should come up then when counter = 2, level 3 should come up.
This is my code in the player class:
This is my code in the world:
public void countLevels()
{
levelCount.add(1);
}
if(world1.levelCount.getValue() == 1)
{
BalloonWorld world = (BalloonWorld)getWorld();
getWorld().removeObjects(getWorld().getObjects(Balloon1.class));
world.Level2();
}
}
public void count()
{
if(getWorld().getObjects(Balloon2.class).isEmpty())
{
((BalloonWorld) getWorld()).countLevels();
}
}
