Highscore

0 favourites
  • 5 posts
  • I am trying to save the Highest Score for a player via Webstorage. The problem I am having though is that I don't want the player's score to overwrite the Highest Score unless the score is actually higher than the Highest Score value.

    So say the player is playing the game and on the first run through, they get 20 points. I want to save this to webstorage (I can do this no problem).

    Say the player plays again and gets 25 points. I want this to save to webstorage.

    If the player plays again but only gets 15 points, I do not want it saved to webstorage because it is less than the 25 previously earned - basically I want to keep track of the player's absolute highest score.

    I am having difficulty doing this. Any tips would be quite welcome! Thank you.

  • if highscore > webstorage.localvalue("highscore")

    set webstorage local value key "highscore' value highscore

  • Oh, huh, I didn't know you could use the webstorage local value as a thing like that for comparison. I will give that a shot. Thank you kindly.

  • I want to make the same for my game, but i can`t even save the highscore at first place. I have 1 Global Variable called "Timelim" thats also the highscore. If i finish the game in 50 seconds for example, the highscore need to be 50, if i finish it in 48 the highscore will need to automatically update to 48. I do this and no result...so i have game event and menu event, in the meny event i have placed this.

    <img src="http://i48.tinypic.com/28s3t52.jpg" border="0" />

    Please help, after the main thing is done i think i can do the rest with this

    if highscore > webstorage.localvalue("highscore")

    set webstorage local value key "highscore' value highscore

    I really like construct 2 and learned everything, but i can`t understand this webstorage...

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • if highscore > webstorage.localvalue("highscore")

    set webstorage local value key "highscore' value highscore

    In my case i need it the other way, first method works, second doesn`t, i can`t understand why. I can`t understand many things in construct, maybe i am dumb.

    if highscore < webstorage.localvalue("highscore")

    set webstorage local value key "highscore' value highscore

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