Webstorage

0 favourites
  • 8 posts
  • Hi guys and gals, I have a problem with WebStorage, and my problem is that I cant get it to work... I read all posts but still dont know what Im doing wrong...

    I have two local values, Score and HiScore. I want to save only the HiScore.

    When Score > HiScore System Set HiScore to Score. (on the game layout)

    I have 4 layouts, one for the menu, game, retry and credits.

    • On the game layout I have this:

    On end of layout, if Score is greater or equal than HiScore set Webstorage.LocalValue("HiScore")

    • On the menu layout I have this:

    Hishscore (text) on created, Set Text to "HiScore: " & HiScore

                                 set local value HiScore to WebStorage.LocalValue("HiScore")

    • And on the retry layout this:

    Hishscore (text) on created, Set Text to "HiScore: " & HiScore

                                 set local value HiScore to WebStorage.LocalValue("HiScore")

    But nothing, what I am doing wrong? It dont quite understand it...

  • "    set local value HiScore to WebStorage.LocalValue("HiScore")"

    Do > Set local value "HiScore" to HiScore

    and to get the value back from the webstorage:

    Do > Set Text to WebStorage.LocalValue("HiScore")

  • Sorry Im still confused, could you please elaborate on that a little bit?

  • Where do I Do those things? On the first layout the player comes across? Or when the game ends?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When the game ends:

    If Score>HiScore :

    -Set Local Value "HiScore" to Score

    -Set HiScore to Score

    Ingame:

    If Score>HiScore :

    -Set HiScore to Score

    When you begin the game:

    On HighScore (the text object) created:

    -Set Text to "HighScore : " & WebStorage.LocalValue("HiScore")

    I think that will work

  • Where it should display the number its blank. I dont understand it

  • Sent you a PM Aphrodite

  • Thanks Afrodite for the help. Im giving up, I hope GameCenter and Xcode will be able to resolve this without being so confusing.

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