Problem with highscores

0 favourites
  • 11 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • <img src="http://i.imgur.com/7dAjSOV.png" border="0" />

    Im trying to add a highscore to my game, but the values dont save

    i tried those tutorials:

    youtube.com/watch

    scirra.com/tutorials/266/webstorage-how-to-save-ingame-information

  • Hi.

    A few things I can see wrong here.

    You need to save the data to webstorage AsJSON so simply add the following excluding the ""'s after "pontos" in the very last line of your code so it reads set localkey "Highscore" to pontos.AsJSON

    Which solves the other problem that you set pontos as a global but in this line of code it's enclosed in "" which the computer then reads as a string

    So if pontos had a value of 100 then typing pontos will record the value 100 but typing "pontos" will record the value pontos. <img src="smileys/smiley5.gif" border="0" align="middle" />

    If the programme is expecting a number and it gets a string you have problems.

    Then delete the 2nd instance of on start of layout/Local key highscore exists it's not neccesary.

    Then you have problems with Highscore you'll notice "" are back on two but not the first usage.

    Have you called an object the same name as a Global (pontos)?

    TBH it's a little messy if you could upload a capX it will be easier all round.

    In the meantime the suffix .AsJSON is your friend have a read up on it and watch out for Globals in ""'s. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • thx

    i did everything, and didnt worked

    i changed "pontos" to score and i got this when i tried to change the asJSON thing

    <img src="http://i.imgur.com/F171DDB.png" border="0" />

    ps: the object "pontos" its a hitbox

    when the player colide with pontos, 1 is added to pontos(now score)

  • hey, i didnt used .AsJSON, and IT WORKED

    dunno why worked without AsJSON, but FINALLY

    thx mate for everything

  • hm... worked fine when i tested from construct 2

    but on dropbox isnt working

    dl.dropboxusercontent.com/u/36301251/flappydoge/index.html

    is this a problem? or its just dropbox?

  • trying to create a APK to test on my phone to see this highscore thing

    someone know if its a dropbox problem?

  • So you have an object named pontos, and a variable named pontos (which is now called score). I don't know hwat AsJSON is but I've never used it although I've never tested my high scores beyond the built in emulator

    Are your objects on the same layout? I was playing with the vertical jump template and mine wasn't working. Turned out the text fields I wanted to update were on a different layout so I had to move my WebStorage actions and events over to that layout.

    Maybe set up a text field on your main layout and see if it updates? Have one with the current score and one with the high score. Also small thing but should your highscore variable start at 0?

  • So you have an object named pontos, and a variable named pontos (which is now called score). I don't know hwat AsJSON is but I've never used it although I've never tested my high scores beyond the built in emulator

    Are your objects on the same layout? I was playing with the vertical jump template and mine wasn't working. Turned out the text fields I wanted to update were on a different layout so I had to move my WebStorage actions and events over to that layout.

    Maybe set up a text field on your main layout and see if it updates? Have one with the current score and one with the high score. Also small thing but should your highscore variable start at 0?

    yeah they are in the same layout, its working fine on OFFLINE PREVIEW (construct 2) but on dropbox isnt working

    thats the problem

    i'll test the android version now

  • is not working on android too

    only works when i test offline with construct 2

    pls help

  • If you could upload a CapX I'll have a look later on for you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you could upload a CapX I'll have a look later on for you.

    its working

    i forgot change Highscore to highscore

    lol

    thx bro

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