How do I saving time or score when < then highscore ?

0 favourites
  • 10 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • hi,

    iam trying saving time score in webstorage but not work (with score < then highscore)

    any help please ?

    thanks

  • Use compare two values when you save the highscore to confirm that score > highscore

  • i use compare variable ... but in this case the score should be < than high score and not >

    because i use time and the lowest time is better , you understand me ?

  • okay then switch it to less than instead of greater than?

  • i switch it to less than the result is that not save the high score and always set it to zero

    try it by your self

  • when i try to save on webscore when score is < than high score it not save .... thats problem (its save only when it is score > high score) ... and in my case i need to save time and the the lowest is better ....

  • Maybe an example will help.

    Commented example capx: StopGo.capx (r168)

    When you press "GO" it sets your score to 0 and starts counting up (based on dt * 1000).

    When you press "STOP" it stops adding to your score and compares that to your best score.

    If your current score is less than your best score, it saves that as the best score in webstorage and updates the display.

    The "Best Score" starts out at a high value, until a better score is made/saved.

    If your game still isn't saving, you might need to share your capx (can use dropbox.com) so someone can test it and see what's going wrong.

  • Maybe an example will help.

    Commented example capx: StopGo.capx (r168)

    When you press "GO" it sets your score to 0 and starts counting up (based on dt * 1000).

    When you press "STOP" it stops adding to your score and compares that to your best score.

    If your current score is less than your best score, it saves that as the best score in webstorage and updates the display.

    The "Best Score" starts out at a high value, until a better score is made/saved.

    If your game still isn't saving, you might need to share your capx (can use dropbox.com) so someone can test it and see what's going wrong.

    one word i want to say you ... THANKS A LOT

    with some modification thats work ... at first i dont understand why you add the ("best_score") , i understand that is just value ... and now work like charm

    sorry for my bad and poor english

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • matrixreal - You're welcome. I'm glad you got it to work.

    Sometimes it's easier to work out from an example than a description.

  • yes just one thing ... when i quite the game ... and relunch it again

    that not save the highscore that save it only when iam on game , if i close it and relunch it again that not work

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