How do I fix a "NaN" error and how do I save coins

0 favourites
  • 4 posts
From the Asset Store
112 High-Quality Coins and Chest SFX specially crafted for video games
  • So I have a game where the player gets coins and those coins save and continue to add up and you'll be able to use those coins with an in game store. But I have run into an issue that maybe someone here can help with. Here is my code for the store

    [attachment=1:3rb0jhr5][/attachment:3rb0jhr5]

    Here is the error that i get

    [attachment=0:3rb0jhr5][/attachment:3rb0jhr5]

    Here is the main part of the game where the global variable is being pulled from

    [attachment=2:3rb0jhr5][/attachment:3rb0jhr5]

    I've tried to follow all of the tutorials with no success. I want the coins to add up, am i doing things right and why do I have the error. any help is greatly appreciated.

  • Everytick can't be on on start of layout.

    On start of layout runs once on start of layout.

    Every tick is every tick of the game and runs continuously.

    I am impressed, this is a brilliant way to get a response. I will love to help you out. Give me a little bit of time and I will come back with the correct sequence to save coins

  • thanks for the quick reply, I will remove that every tick but once I do what else would I put there?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • giffjo

    I'm back as promised with a demo - Apology, I did this quick but it works and I managed a few comments

    Edit: Forgot to add instructions. Left mouse click adds coins and right mouse click removes them. I needed a way to add coins, don't know how you doing it.

    Also, it is all automatic. All you need to do is add/subtract and it saves to global variable "coins"

    It also auto saves to webstorage when coins does not equal totalcoins.

    I also added auto load of users stored coins when they come back to game.

    And added a reset button.

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