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

Get help using Construct 2

Post » Mon Mar 03, 2014 6:43 am

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
store.png

Here is the error that i get
error.png

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

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.
You do not have the required permissions to view the files attached to this post.
B
4
S
1
Posts: 27
Reputation: 504

Post » Mon Mar 03, 2014 7:02 am

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
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Mon Mar 03, 2014 7:04 am

thanks for the quick reply, I will remove that every tick but once I do what else would I put there?
B
4
S
1
Posts: 27
Reputation: 504

Post » Mon Mar 03, 2014 7:22 am

@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.
You do not have the required permissions to view the files attached to this post.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Nicolas951 and 11 guests