How do I make highscores Construct2

0 favourites
  • 5 posts
From the Asset Store
It is a powerful and complete package containing a total of 20 enemy AI mechanics.
  • Hi, I was following the tutorial on the highscores for construct2() and i must admit that it was very well done. However i'am having a little problem. I'am making an infinite runner game,it has a score system but the highscore is not working. It's always at zero. The reason I'am thinking it happens is because if the player falls then there is a reset global variables to default event that occurs and might affect the highscore variable(not sure tho). Do you know how to fix it?

    I won't be able to send you a capx file because the game is set to be released soon and the art can't be seen yet. However it mostly uses the event of the infinte run template on construct 2 slightly modified so u could use that as a base. I would really appreciate if you respond ASAP as i'm running out of time. Thanks

    PS: I asked for help a while ago and didn't choose the notify button. I received many replies very fast and as i found the solution myself didn't even check. I feel terribly sorry and am very happy about this community T-T

  • You do not need to place a full capx with your whole game and art, you can just reproduce the lines of code in an example (especially if you used a template), just put placeholders like boxes. If not, then, can you at least place an image of the section where you are evaluating the high score? I followed the tutorial and it works fine for a runner. It is really hard to review/help with something without seeing the code (too many assumptions have to be made...).

  • Hi, here is a demo of the game with construct's art

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • there are some issues in the code.

    You are not using the webstorage correctly. You also placed a Set Highscore to Highscore, therefore, and you defined highscore=0 ... so you will always have highscore as 0.

    Another thing is that the order of execution does matter. When you die, you reset the global immediately... instead, you should have the webstorage (as step 3 below) and then reset the variables and layout. If not, you are just resetting and saving the highscore as 0.

    1. Try this, use " " for all highscore value

    2. On the start layout -> Webstorage -> Local key "highscore" exists | System -> Set highscore to WebStoreage.localValue("highscore")

    3. On comparing the distance, webstorage-> set local key "highscore" to totaldistance

    That worked on the mini test I did.

  • Thaaank you so much,it worked!! Not only did I learn that the order of events matters but that so does the quotation mark. You're the best!

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