Im having issues getting my game to level up and having both my score board to show each what level im on and having it go away after 60 time steps can anyone help
/**
* A world for the boids.
*
* @author Poul Henriksen
* @version 2.0
*/
public class Sky extends World
{
/**
* Counter Object Used to keep the score
*/
private ScoreBoard;
private Counter scoreCounter;
private Timer gameTimer;
private int numberOfBoids;
private double percentageToWin;
private int level = 1;
/**
* ADD CODE HERE
* You need a variable to keep track of what level you are on.
*/
/**
* Constructor for objects of class Sky.
*
*/
public Sky()
{
/**
* EDIT CODE
* Sort your code, move the "stuff" that changes to your level up method
* The "stuff" that stays the same can stay in the constructor
*/
super(800, 600, 1);
getBackground().setColor(new Color(220,220,100));
getBackground().fill();
// Create a new scoreCounter object and then add it to the world
scoreCounter = new Counter("Score: ");
addObject(scoreCounter, 55, 580);
ScoreBoard = new ScoreBoard("levelUp: ");
/**
* ADD CODE HERE
* Call your level up method
*/
levelUp();
}
/**
* This is your level up method
*/
public void levelUp()
{
/**
* ADD CODE HERE
* If you are not on level one, then show a scoreboard that says you have leveled up
* Leave it on the screen for 60 time steps
*/
if(level!=1)
{
addObject(new ScoreBoard(scoreCounter.getValue()), getWidth()/2, getHeight()/2);
Greenfoot.delay(60);
removeObtect(ScoreBoard);
}
/**
* ADD CODE HERE
* Once you scoreboard goes away, you need to clear the world of all objects
*/
Greenfoot.delay(120);
removeObject(gameTimer);
removeObjects(getObjects(Boid.class));
removeObjects(getObjects(Tree.class));
removeObjects(getObjects(Hunter.class));
/**
* ADD CODE HERE
* All of the "stuff" that changes goes here
*/
/**
* Create a new timer object and then add it to the world
*/
gameTimer = new Timer("Time Remaining: ");
addObject(gameTimer, 100, 560);
/**
* Set the number of boids and the percentage to win the game
*/
numberOfBoids = 50;
percentageToWin = 0.25;
populateTrees(100);
populateBoids(numberOfBoids);
/**
* Create a shooter
*/
Hunter myHunter = new Hunter();
addObject(myHunter, getWidth()/2 ,getHeight()/2);
/**
* Make a predator and add it to the world
*/
Predator myPredator = new Predator();
addObject(myPredator, 0 , 0);
/**
* ADD CODE HERE
* Now that you have done everything, don't forget to add 1 to your level
*/
level++;
}

