How do I local storage

  • Okay so after hours of looking around tutorials and capx files I am posting this.

    I am making a platform game where you have to try and do it as fast as you can. I have 3 levels, and on my level select screen i want to have the fastest times underneath each level icon. However I just cant figure out how to do local storage.

    At the moment I am setting my Highscore/fastest time to something REALLY high and then saying If timer is lower than FastestTime set Highscore to Score. I need a way of saving my Fastest time, as at the moment it only says the Previous time.

    Thanks

  • What tutorials have you tried and what part of them didn't you understand?

    This one even has a capx you can download..

    Also, why a second topic with the same question?

  • Thanks for the reply,

    I'm not really a programmer and don't fully understand local storage.

    All of the tutorials I copy never seem to work for me. Getting kind of frustrating!

    Thanks for your link, although the examples use web storage.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All I need is for Local storage to save my score when It is lower than my current high score/time.

  • The example uses webstorage?

    What example?

    You can't be talking about the capx attached to the local-storage tutorial, for it ,ofcourse, uses local-storage..

    you just need this:

    on start of layout

    localstorage check item "highscore" exists

    localstorage "highscore" exists

    system set global variable Highscore to localstorage.itemvalue

    on game ended (you should know which triggered event you could use for this in your capx)

    System compare two values : Score < Highscore

    localstorage set item "highscore" = Score

    The tutorials explain this much better and in greater detail..

  • Once again you have helped me out Little Stain,

    With a few tweaks I got this working!

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