Hey, I've been trying to put a simple text into my gameover code but I don't know how to switch worlds so I thought I'll just put in the code myself, but it doesn't appear on the screen. I also want to put in the score that the player has got from the game, and so I want to put the counter into the gameover world as well but I'm not too sure on how to display the previous score that the player had gotten before s/he died.
I also want it so when your on gameover world you can press 'esc' to go back to the startmenu world but It doesn't work.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Gameover here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Gameover extends World
{
/**
* Constructor for objects of class Gameover.
*
*/
public Gameover()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(659, 483, 1);
}
private void prepare(){
Gameover1 gameover1 = new Gameover1();
addObject(gameover1,350,219);
}
public void act(){
if(Greenfoot.isKeyDown("esc"))
Greenfoot.setWorld(new Startmenu());
}
}


