Highscore displaying NaN using webstorage

Get help using Construct 2

Post » Thu Sep 11, 2014 6:23 pm

So my game is almost finished and I wanted to add highscores. I searched for some tutorials and I read most of 'em. But for some reason the highscore value keeps displaying "NaN". For ease of understanding I created a new construct 2 project where I have the same problem.

What am I doing wrong?

The included capx file is very basic. Its a text box, when the game starts: every second 1 is added to score. and then if score is higher than highscore it will be saved and displayed.
You do not have the required permissions to view the files attached to this post.
Posts: 8
Reputation: 218

Post » Thu Sep 11, 2014 7:32 pm

set highscore to int(webstorage.localvalue("highscore")) will work as explained in the manual..

Webstorage is stored as a string and a string is NaN (Not a Number), to convert the string to an integer(number) you use int..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Post » Mon Sep 22, 2014 9:14 am

@LittleStain thanx its helped me too :)

Hello Sir, i wanted to implement facebook score system same like subway surfer? could you please help me and let me know if this possible without publishing on facebook? as i am only wanted to publish on mobile platform.

Please help me to achieve this,

Thanks in advance :)
Posts: 53
Reputation: 1,236

Return to How do I....?

Who is online

Users browsing this forum: Colludium, Google [Bot] and 7 guests