Hi guys, I’m having a problem trying to add a highscore feature on my game to be displayed below the score which shows the highest score you get from collecting the coins.
I have no idea how to tackle this and add it to my game.
I have attached 2 images one of the coin blue print and one showing the score feature on my game interface.
you will need a variable to hold your high score. At the end of play, compare the Total Coins with the High Score. If the Total Coins is higher than the Total Coins, then set the High Score to Total Coins.
Like he said. Make an integer variable somewhere that remembers the highest score. (Make a save game file that contains it, if need to be remembered every time you play. or a game instance if you reload the level, and want to remember this between loads).
Compare the current score with the high score, and if its bigger, set this as the new score.
Then create a widget that looks this score up, and set this as a text in the widget.
So the difficulty also depends on how, when, and where you want it to show
Could show an example of how to do this exactly from what he has I am in the same boat I have figured everything out so far for my game except this high score and to save it. PLEASE
I used this tutorial to learn save/load games.
You whan the game opens, you can load a file with the high score in it, and use this a a current high score variable.
This is how i would compare the high scores, and then save the highscore immeately afterward, if you don’t want to go into game instancing, which is a bit more complicated.