score and highscore

0 favourites
  • 14 posts
From the Asset Store
Create the right kind of drama with Film Scoring Tools sound library!
  • how is the best way to set up the score system? So far i have a variable localscore which resets after level restart and only shows the score gained during the last play. Then i have globalscore which im not sure how to setup. Logicaly the globalscore should be only rewrited if the player has gained more score but i dont know how to set it up

    thanx in advance!

  • Just do like this.

    Add a global variable called "Top score"

    Then compare that against local score when the game ends.

    if "Top score" < "local score" Set "Top score" = "local score"

  • nimos thanks, i also need to check the highscore after restarting. I have to save the highscore to webstorage i suppose?

  • I haven't actually used webstorage that much, but as I remember there is something about if you clear the cache you might loose it, but you can check that in the manual, as im not sure :D

    But yes you could do that.

    Just add this to the event where you want to save the score.

    To save:

    Webstorage -> set local key "Highscore" to Highscore

    To load:

    System -> on start of layout -> set Highscore = Webstorage.localvalue("Highscore")

  • You can also give it a look at this tutorial

  • Nimos thanks but it seems that im making some mistake. Can you please give me more detailed instructions on how to do this:

    when i first finish a level i need to set this as a score and highscore aswell - i need to save the highscore. When the level is replayed, i need to load the highscore and compare it with current score. The higher will be set as text.

    thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I use web storage that's the best way I've found.

  • wow thanks ArcadEd :)

  • Nimos thanks but it seems that im making some mistake. Can you please give me more detailed instructions on how to do this:

    when i first finish a level i need to set this as a score and highscore aswell - i need to save the highscore. When the level is replayed, i need to load the highscore and compare it with current score. The higher will be set as text.

    thank you!

    Here is how you can do it, I just made it with some buttons to simulate how it should work, you just have to put them into the correct places ofc.

    However I would strongly suggest that you use functions to do it, as it would be a lot better. This example is just to show how to do it and to keep it as simple as possible, but if you know how to use functions I would strongly recommend doing that.

    Highscore test

  • Finaly its functional however it doesnt save the variables after restart. :/ Any ideas?

  • Nimos thank you i will try it :)

  • Nimos, you have a newer version of Construct i cant open it:/ I havent founf thr 148 version on scirra page. Only 149 which is beta. Im using 146, 64bit

  • To both: Finaly solved :) i had the loading webstorage event on wrong event sheet

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