[ASK] [Problem] Web Storage Coin Error

Get help using Construct 2

Post » Tue Feb 17, 2015 7:11 am

[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.
Image

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

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

Where is my problem? and how to fix that?
Thanks ^^. :D
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
B
6
Posts: 16
Reputation: 282

Post » Tue Feb 17, 2015 9:12 am

Try this:
Image

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.. : -)
B
32
S
17
G
4
Posts: 182
Reputation: 5,193

Post » Tue Feb 17, 2015 9:18 am

if the above doesnt work try

int(WebStorage.LocalValue("SCoin"))
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Tue Feb 17, 2015 2:42 pm

Message: yusriltakeuchi is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
odiusfly wrote:Try this:
Image

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 :)
B
6
Posts: 16
Reputation: 282

Post » Tue Feb 17, 2015 2:43 pm

volkiller730 wrote:if the above doesnt work try

int(WebStorage.LocalValue("SCoin"))


Still not working on here ._.
B
6
Posts: 16
Reputation: 282

Post » Tue Feb 17, 2015 9:55 pm

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..
B
32
S
17
G
4
Posts: 182
Reputation: 5,193

Post » Wed Feb 18, 2015 12:34 pm

odiusfly wrote: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 :D
B
6
Posts: 16
Reputation: 282

Post » Wed Feb 18, 2015 3:30 pm

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?
B
32
S
17
G
4
Posts: 182
Reputation: 5,193

Post » Wed Feb 18, 2015 3:40 pm

odiusfly wrote: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 ^^
B
6
Posts: 16
Reputation: 282

Post » Wed Feb 18, 2015 3:50 pm

: -)
B
32
S
17
G
4
Posts: 182
Reputation: 5,193


Return to How do I....?

Who is online

Users browsing this forum: Greaver, Husui, jeffige, Nxs, SEGamestudio and 36 guests