Nan or 0 Highscore Problem

0 favourites
  • 3 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • Hello every1!

    I was trying to make an highscore, and watched alot tutorials and browsed here in the forum but nothing helped so i try it with an new topic

    -----------------------------------------------------

    Global Number: Highscore

    Global Number: Score

    On Start of Layout: Local Key "Highscore" Exist - Set "Highscore" to int(WebStorage.LocalValue(Highscore))

    ---Set Text to "Highscore" & Highscore

    (else)

    ---Set SessionKey "Highscore" to "0"

       Set Text to "Highscore" & Highscore

    Keyboard: On W pressed - Restard Layout

    Keyboard: On S pressed - Lear Local Storage

    Keyboard: On A pressed - Add 1 to "Score"

    Score > "Highscore" Set Local key "Highscore to "Score"

    Every Tick - Set Text to "Score: " & Score

    --------------------------------------------------------------

    Thank you,

    -Astronaughty

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have the same problem... Please someone can help?

  • From the examples you typed I would say you have some qoute misplacements, but seeing as they are typed over, there is really no way of saying ... anyways

    Things I see typed wrong:

    [quote:35dsnw9t]On Start of Layout: Local Key "Highscore" Exist - Set "Highscore" to int(WebStorage.LocalValue(Highscore))

    the bold part should be

    int(WebStorage.LocalValue("Highscore"))

    Highscore should passed as a string which references the name of the variable in web storage.

    Without qoute, it will try to use the Highscore value (likely a number) as a name to reference the web storage variable.

    and

    [quote:35dsnw9t]Score > "Highscore" Set Local key "Highscore to "Score"

    the bold part should be

    Score

    Beacuse::

    Score is a variable, if you place it between qoutes it becomes the string "Score" and not a variable.

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