How do I: Save scores?

  • Hey,

    So I made an app where if the user is at school, on-time(8:45am), it will award them 1000 points by checking their geolocation and using system time. Only problem is that I can't get the score to save using local storage. The score just comes up as NaN or just stays at 0 everytime I tried using local storage. I want the app the save the user's collective score.

    This is my first time ever using Construct 2, so help would be very much appreciated!

    Thanks!

  • The local storage is only active so long as the app is running. If you close the app the local storage is cleared.

    You have to have a server database to save data between sessions, or just keep your app open constantly.

    One side question, what if they simply change the system time?

  • The local storage is only active so long as the app is running. If you close the app the local storage is cleared.

    No. This is wrong. The local storage data persists even if the app is closed.

  • No. This is wrong. The local storage data persists even if the app is closed.

    I stand corrected then.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • SecretaryBird - Local storage should work.... Can you show the rest of the event, especially the part when you set the score value to the local storage? But providing a .capx is better.

  • Nan usually means you are trying to use the wrong data type.

    As I recall, storage only uses strings, so you should probably add an int() to the return values.

    Also, think of local storage as you would a cookie.

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