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

2021/3/15

Scoreboard for time based game

AnJoMorto AnJoMorto

2021/3/15

#
Hi, So I have this game with two game modes where you have to collect 5 chests. There's a stopwatch counting the time taken to complete that. Once you collect all the 5 chests a new world (WinMenu) will open. This world class has stored in World world the previous world and Timer is sharing the String result that shows the time elapsed in a 00:00:00.00 format, as well as int elapsedTime where is stored the time before formatting. With this I would like to make a 2 Scoreboard worlds (or just one if possible or simpler) where the player can access the top 5 players with their time for each mode. I was wondering if it would be possible to achieve that with the built-in ScoreBoard class? If it is the case some help for how to use that said class in my situation would be appreciated since I still didn't quite understand how UserInfo works. If not I'll just try to make it with File i/o and only have the scoreboard in local. Thank you for your time.
danpost danpost

2021/3/15

#
UserInfo has only ONE score field. You can only store high scores for only ONE mode using the built-in ScoreBoard class.
danpost danpost

2021/3/15

#
One thing that could be considered here. You could combine the two scores to create a "general" high score and store the individual mode scores in two int slots. Since a minimum time would be a better "score", you would want to store negative values in the score field so that the higher values are the lower negative values for getting top scores. When saving a mode time after only one mode is completed, if other mode int value is zero (mode not yet completed), add some ridiculous large amount of time to score (leave int for that mode zero so you can tell that task has not been completed). Use int values for displaying scores (do not display zeros). You will have to either do major adjustments to the ScoreBoard class or write one of your own to suit your requirements.
AnJoMorto AnJoMorto

2021/3/19

#
Sorry for such a late response. I didn't have the time to come back to programming this last days. Thank you, @danpost, for your answer. I'll try to figure a way out to achieve it with the information you gave me. Thank you and all the best
You need to login to post a reply.