How do I create a top 10 highscore list?

0 favourites
  • 7 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • Hey everyone.

    I was able to create a score and now I want to have a Layout where the player can see a List of the 10 best scores he has made in the game.

  • I assume this is for single player offline and not via scirra arcade.

    You will need to learn how to use local storage first, it is not too complex.

    You will need a variable to store in local storage that tracks how many times player "won" and increments each time by one... ie. timesScored=0.. (win) timesScored=1.

    You will then need to make a variable for each score you want stored. You can use global variables for this or make a global sprite "brain" with instance variable inside (1 for each score stored).

    In your win (or scored) events you will need to condition out timesScored=0 TextScore1 set text "Score: "&Score1var... etc

    If you want incremental (highs to lowest) you will need to use conditions prior to displaying to check if score1 is > score2 etc.

    Or for advanced users, store them in an array.. or even dictionary.. or.. many ways..

  • I assume this is for single player offline and not via scirra arcade.

    You will need to learn how to use local storage first, it is not too complex.

    You will need a variable to store in local storage that tracks how many times player "won" and increments each time by one... ie. timesScored=0.. (win) timesScored=1.

    You will then need to make a variable for each score you want stored. You can use global variables for this or make a global sprite "brain" with instance variable inside (1 for each score stored).

    In your win (or scored) events you will need to condition out timesScored=0 TextScore1 set text "Score: "&Score1var... etc

    If you want incremental (highs to lowest) you will need to use conditions prior to displaying to check if score1 is > score2 etc.

    Or for advanced users, store them in an array.. or even dictionary.. or.. many ways..

    Do you know any tutorial that might help me?

    Found this but it's not up to date.

  • Good local storage tutorial. It is the part the other tutorial seems to be out of date on (it's using old webstorage).

    https://www.scirra.com/tutorials/1461/how-to-use-the-localstorage-plugin

  • Good local storage tutorial. It is the part the other tutorial seems to be out of date on (it's using old webstorage).

    https://www.scirra.com/tutorials/1461/how-to-use-the-localstorage-plugin

    Will I need to work with arrays too?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Arrays would be the much cleaner and shorter code way to do it.. and you will only help yourself by learning them.

    You can do it using just variable as I pointed out above but your code will be 3x as long.

  • Arrays would be the much cleaner and shorter code way to do it.. and you will only help yourself by learning them.

    You can do it using just variable as I pointed out above but your code will be 3x as long.

    I've read an explanation aboutthem but didn't really understand it. Have to give it another try.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)