hello how can i end a game when the player loses???? do i set a new background with the words "game over" or is there another way to do it?
// in World subclass
public void gameOver()
{
remeoveObects(getObjects(Actor.class)); // remove all actors from world
GreenfootImage bg = getBackground(); // get reference to background image
bg.setColor(Color.BLACK); // set drawing color to black for 'bg' image
bg.fill(); // fills 'bg' image with the currently set drawing color
GreenfootImage txtImg = new GreenfootImage("GAME\nOVER", 80, Color.WHITE, Color.BLACK); // create "GAME OVER" text image
bg.drawImage(txtImg, (bg.getWidth()-txtImg.getWidth())/2, (bg.getHeight()-txtImg.getHeight())/2); // draw text centered onto 'bg' image
Greenfoot.stop(); // stop the scenario
}