How do I do highscore?

  • Hi.

    I've made a score and a high score using localstorage,

    the highscore appears on another layout and it works fine.

    but i noticed that when i close down the mobileapp and open it up again a moment later the high score is back to 0.

    any idea guy?

  • Do you save TO local storage when setting the highscore?

    Do you load FROM local storage when starting the game? (this is probably the issue)

  • Hey!

    Thanks for your answer.

    I'm trying to upload a photo of exactly what I've done but I can't find a way to upload the image.

    But here is what it looks like coaded.

    + System: On start of layout

    -> LocalStorage: Check item "Highscore" exists

    + LocalStorage: On item " : " exists

    -> System: Set Highscore to LocalStorage.ItemValue

    + System: Score > Highscore

    -> System: Set Highscore to Score

    -> LocalStorage: Set item "Highscore" to ": "

    + System: Every tick

    -> Highscore: Set text to " : " & Highscore

    where have i gone wrong?

    This is what i use as a high score text if you wonder -- > ( " : " )

    Thanks in advance

  • + System: On start of layout

    -> LocalStorage: Check item "Highscore" exists

    + LocalStorage: On item " : " exists

    -> System: Set Highscore to LocalStorage.ItemValue

    do you use the same name in Check Item "highscore" and On item "highscore" exist?

  • I'm not sure, I Believe so.

    have you got a capx or something to show me how to save the highscore, and then how to load highscore, on start of layout?

  • mega.nz

    when you said capx did you mean capx? (construct 3 has .c3p not .capx) - this is a .c3p

  • Tackla

    Is this query for Construct 2 or 3?

    If C2 then I will move this thread for you.

  • yes that's what i meant.

    it's for construct 3.

    thanks a lot!

    i opened it, and it looks almost like the one i've done.

    i'll try it out.

    do you think it'll work even if i want the highscore to appear on another layout?

    Thank you very much for your help

  • You could just make the highscore variable Global so you can use it in another layout (first layout should be the one where you load from localstorage)

  • Hi again.

    It didn't seem to work for me. even though the example you send me work perfect.

    i don't understand what i'm doing wrong.

    i'm using global number. i saw you were using Local static number, but i don't know how to use that.

    maybe that is the peoblem.

    what do you think?

  • global & static local should not make a difference.

    can you send a screenshot of your events?

    you have to upload on imgur or somewhere else and then post the link here

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I made it

    I had just done somehing wrong on the name of the Item in localstorage Check Item exists.

    It works perfectly!

    The score stores it self as i want it to.

    thank you very much for taking your time and helping me out.

    Thanks a lot

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