Would someone be able to give me a code for a simple game over end screen once the character loses all of his lives or is taken away from the world
if (characterDies()) {//only an example;
World world = getWorld();
world.removeObjects(world.getObjects(null)); //removes all the objects in the world;
world.addObject(new GameOverScreen(), world.getWidth()/2, world.getHeight()/2); //adds the game over screen in the middle of the world;
}World world = getWorld();
if (world != null) {
world.removeObjects(world.getObjects(null));
}Actor Rocket;
Rocket = getOneObjectAtOffset(0,0,Rocket.class);
if (Rocket != null)
{
World world = getWorld();
world.removeObjects(world.getObjects(null));
}world.addObject(new GameOver(), world.getWidth()/2, world.getHeight()/2);
world.setBackground("game_over.jpg");
Greenfoot.stop();Actor Rocket;
Rocket = getOneObjectAtOffset(0,0,Rocket.class);
if (Rocket != null)
{
World world = getWorld();
world.removeObjects(world.getObjects(null));
// here
}