How can I end the game, when counter gets nuber X and after than the world image will change?
if (counter == X)
{
getWorld().setBackground(/* new background image */);
getWorld().removeObjects(getWorld().getObjects(null));
Greenfoot.stop();
}if (counter == X)
{
getWorld().removeObjects(getWorld().getObjects(null));
getWorld().setBackground(/* new background image */);
Greenfoot.stop();
}