I am programming a little pause screen for my 2D jump'n'run -game.
It simply does create a object named pauseScreen, if the escape-button is pressed and all actors extending the Pause-class stop executing the act()-method. It works quite fine, it also does resume to the game, if the enter-button is pressed, but it doesn't remove the pauseScreen-object, although i have used the removeObject()-method.
I have no clue why this doesn't work. Could anybody help me please?
public boolean pause()
{
gameWorld1 theWorld = (gameWorld1) getWorld();
PauseScreen pauseScreen = new PauseScreen();
if(Greenfoot.isKeyDown("escape"))
{
theWorld.addObject(pauseScreen, 500, 300);
Greenfoot.delay(10);
answer = true;
}
else if(Greenfoot.isKeyDown("enter"))
{
theWorld.removeObject(pauseScreen);
Greenfoot.delay(10);
answer = false;
}
return answer;
}

