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

2015/10/22

how to make menu and highscore screen?

AngelusNeko13 AngelusNeko13

2015/10/22

#
can anyone please show me how to make a highscore screen function? i already have the counter done but i want to record the highest counter everytime i play the game to post highest scores, also can anyone show me how to make a certain button go back to the menu screen without pausing the simulation? i have the menu done but if i dont pause the simulation the game itself keeps going and adding points, im sorry if this is confusing but i need alot of help on this part
Super_Hippo Super_Hippo

2015/10/22

#
For the points: Only increase it until the game is over. You could have a boolean indicating if the game is over.
1
2
3
4
5
6
7
8
9
10
private int time = 0;
private boolean gameOver = false;
 
if (/* ... game lost ... */)
{
    gameOver = true;
}
 
//then use this condition to increase score
if (!gameOver) time++;
For a highscore table, you could import the ScoreBoard class and follow the instructions given. If anything is unclear, feel free to ask.
AngelusNeko13 AngelusNeko13

2015/10/23

#
well im trying to make the last highest scores to be displayed on a new scoreboard world
danpost danpost

2015/10/23

#
Use a class field ( static int ) in your game world to hold the highest score. When the game ends, compare the latest score with the value in the field; if it is higher, change the field value to the latest score. Then, create the new scoreboard world that displays the value of that field.
AngelusNeko13 AngelusNeko13

2015/10/23

#
hmmmm okay i kinda get that buuut im a bit confused, im so sorry im a complete beginner at this :(
You need to login to post a reply.