How do I fix my high score? [Please Help]

Get help using Construct 2

Post » Mon May 27, 2013 10:47 pm

Hello all, I'm wondering...

How do I reset my high score back to 0? I'm using web storage. It seems like it should be really simple... Do I set the value of the stored item(cookie) to 0? If so, how exactly do I do it?


Thanks all,
guannstarguannstar2013-05-28 04:06:00
B
28
S
5
G
1
Posts: 590
Reputation: 3,278

Post » Mon May 27, 2013 11:41 pm

You can just create an event like On Key Press (pick a key) and for the action, clear local storage or clear session storage.

Just remove it before you finish up your game.
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,532

Post » Tue May 28, 2013 12:11 am

Thanks a lot, I'll try it and see if it works...
B
28
S
5
G
1
Posts: 590
Reputation: 3,278

Post » Tue May 28, 2013 3:42 am

I tried it and it did work, but now there's another problem! It seems like turned it off rather than reset it... It won't keep score anymore:( It seems broken. How do I turn it on, or activate it again?
B
28
S
5
G
1
Posts: 590
Reputation: 3,278

Post » Tue May 28, 2013 3:45 am

Yea, it just seems to stay at 0 now:( How do I fix it?
B
28
S
5
G
1
Posts: 590
Reputation: 3,278

Post » Tue May 28, 2013 4:40 am

how do you have it setup to clear the storage? Can you show the code snippet of where you are clearing it?
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,532

Post » Tue May 28, 2013 4:46 am

Sure, here it is...
B
28
S
5
G
1
Posts: 590
Reputation: 3,278

Post » Tue May 28, 2013 7:06 am

Ok, the only place you are setting the high score is on the start of layout. Since varHighScore is 0 at that point, it setting 0 to the webstorage.

Try creating another Keyboard event to give yourself a score to play around with it. Or 2 keys to give different scores for testing.
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,532

Post » Tue May 28, 2013 7:27 am

I'm not sure if I get it:( Can you show me what Action path would look like? For example... Keyboard-->On "H" Pressed-->Webstorage-->?????

Thanks,
guannstar
B
28
S
5
G
1
Posts: 590
Reputation: 3,278

Post » Tue May 28, 2013 7:47 am

What I mean is, right now your code is never setting a highscore to the webstorage, so naturally it's 0.

Maybe this will help if you haven't seen it yet.

          http://www.youtube.com/watch?v=06-LgQxceGgArcadEd2013-05-28 07:47:56
B
100
S
31
G
11
Posts: 1,552
Reputation: 21,532

Next

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 3 guests