Saving a high score

edited April 2018 in Android Mode

Hi all! Hope you're having a good day.

I recently made an android game and I want to be able to save a high score. I've tried looking at other discussions on this forum but I couldn't find anything relevant to Android mode. Most of it was to do with Java mode. If it's relevant, I only need to save a single number at any one point in time.

Here are the steps that I believe I need to take in order to create a high score:

  1. Upon opening the app, check if a highscore.txt file is saved and if so, load it. Otherwise, create a new highscore.txt file with its only content being '0'.

  2. Upon 'death', aka playing and losing the game, compare the number in the highscore.txt file against the current score.

  3. Overwrite the highscore.txt file with the higher score.

My score is an int value named currentScore.

I've tried tinkering around to implement it myself, but I don't know where to start with permissions and everything.

Any help would be greatly appreciated! Have a nice day :)

Answers

Sign In or Register to comment.