This site requires JavaScript, please enable it in your browser!
Greenfoot back
SP00F3R
SP00F3R wrote ...

2013/6/12

Removing the pause function at game over screen

SP00F3R SP00F3R

2013/6/12

#
I have added a game over screen to my game which appears when lives is less than 1 and have added a pause function when the user presses 'p'. When the game over screen appears the user is able to press the pause button and the pause screen appears. Is there anyway or removing key functionality when the game over screen is displayed?
Zamoht Zamoht

2013/6/12

#
Put your pause function in an if-statement:
if (!gameOver())
{
     //put your pause function in here
}
You have to code the gameOver() method to check wether the game is over or not. Please tell me if this doesn't solve your problem.
SP00F3R SP00F3R

2013/6/12

#
I dont have a game over method, as the game over is displayed when the players number of lives is less than 1. This is carried out in the player class in a hit detection method. Is there a way of removing key functions when the numeber of lives is less than 1? Or any way of pausing the pause functionality when it is less than 1?
davmac davmac

2013/6/12

#
Create a boolean variable in the world to track whether it is currently game over or not. Have the player class set that variable when it displays the game over screen. Check that variable before allowing the pause action.
You need to login to post a reply.