Hi,
how would I go about adding a "play again" button on the scoreboard? The scoreboard is the imported classes from within greenfoot.
public void act()
{
if (Greenfoot.mouseClicked(this) )
{
Greenfoot.setWorld(new City());
}
} removeObjects(getObjects(Mover.class));
private boolean over;
// then in act
public void act()
{
if (bar.value == 0 && !over){
gameOver();
} else {
// all the other act code
}
}
// then in gameOver
public void gameOver()
{
bgSound.stop();
scoreSound.playLoop();
removeObjects(getObjects(null));
Saver saver = new Saver();
saver.saveHighscore(theCounter.getValue());
ScoreBoard board = new ScoreBoard(getWidth(), getHeight());
addObject(board, getWidth() /2, getHeight() /2);
addObject(new PlayAgain(), 393, 26);
over = true; // so we don't run this again
}