How do I keep the best score!!!

0 favourites
  • 5 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Ok the title is a bit awkward. I really don't know how to make a title but i can explain what my problem is....

    I have a game with many levels. On each finished level you get STARS as your score. 3 STARS is best score.... So lets say I finish a level with 2 STARS and I wanna repeat it.The next time I do worse and end up with one STAR. Score for that level now shows 1 STAR which is a problem... I want it to keep my best score so that everytime I do worse I'd have my best score not the current one I got.

  • 1st You'll need a bunch of variables here, or a vector. I'll explain how to use the variables, you can check out array tutorials later on if you want to learn to use the tools construct2 offer you.

    2nd You can easily figure this out by yourself by studing the construct2 manual and reading tutorials. It's a good thing to understand about construct2 before trying to create your algorithms.

    3rd here we go.

    You will need a variable to keep track of the maximum amount of stars the player acquired each level, StarLevel1, Starlevel2, StarLevel3 and so on. Or you can create a single array to save all of them but whatever.

    You will also need a variable to keep track of the amount of stars, or score that the player manage to reach in that specific level. Lets call it "CurrentScore" for now.

    So what you want to do is, every time the player finishes a level, you save his new score at the "CurrentScore" Variable, and then AFTER that, you go and check if the value at the "CurrentScore" is bigger or lesser than the value on the "StarLevelX" that keeps track of the max score, and do the changes accordingly .

    The code sheet would go something like this:

    add action > system > set value :

    Variable : Stars

    Value : currentScore > stars? Currentscore : Stars

  • You need a "Island" load out where you go between levels to share data.

    In that level have an array that you load from local storeage with the score first on the top of the X axis. On the Y axis under the score have the player name who got that score.

    At that point you can do an array "Sort" action on the X axis, this will sort them from highest to lowest.

    You might not need the "island level" but it makes it easy to break things up, so you game does not get too cluttered. It also can add some charm to the game like how Super Mario world, and Yoshi island is between levels. This also gives your player a chance to take a break and mull over their scores.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Checked some tutorials and used the array for it... Works like a charm.

    Appreciate the help

  • Glad to help

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