[ASK] [Problem] Web Storage Coin Error

  • [ASK][Problem]

    Excuse me, i want to ask something with my problem.

    This is about Web Storage.

    I want to set my Coin Variable to Web Storage. Function that coin stored forever

    I'm add Web storage Set Local key "SCoin" to Variable Coin When the player has collision with coin.

    And also add Set value Coin to WebStorage.LocalValue("SCoin") when layout has starting.

    But the results are bad, when I play my game, variable coin into the error that becomes NaN

    Where is my problem? and how to fix that?

    Thanks ^^.

    And sorry if my english is very bad, because i'm not really can speaking english

    I hope you will reply to this problem quickly

  • Try this:

    You don't need to put it under of "On start of layout", maybe work maybe not under "On start of layout".. Just make your tests!

    Check also if your global variable "scoin" the type is number or text. Change this to number.. : -)

  • if the above doesnt work try

    int(WebStorage.LocalValue("SCoin"))

  • Try this:

    You don't need to put it under of "On start of layout", maybe work maybe not under "On start of layout".. Just make your tests!

    Check also if your global variable "scoin" the type is number or text. Change this to number.. : -)

    Can you help me to fix my problem?

    I've tried various ways but until now has not succeededI am very grateful if you want to help me

  • if the above doesnt work try

    int(WebStorage.LocalValue("SCoin"))

    Still not working on here ._.

  • I think the best way is to share the project file.. or if you have full project.. just make a demo version only the important code.. to fix it! : -) Share here or if you want pm me!

    Cheers..

  • I think the best way is to share the project file.. or if you have full project.. just make a demo version only the important code.. to fix it! : -) Share here or if you want pm me!

    Cheers..

    Yeah, this is my project file: dropbox.com/s/yt6cm8763ve1n8g/Alien%20Escape.capx?dl=0 I hope you can help me. Thanks

  • Hey i check your file.. the high score is working... and the coin section is 0.. No "Nan". So, what is the problem? You want to save the latest coin as high score does?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey i check your file.. the high score is working... and the coin section is 0.. No "Nan". So, what is the problem? You want to save the latest coin as high score does?

    Ah sorry, this problem has fixed, and thank you for you help ^^

  • : -)

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