How do I use the LocalStorage Plugin?

Get help using Construct 2

Post » Wed Jan 06, 2016 5:17 pm

B
14
S
5
Posts: 23
Reputation: 1,070

Post » Fri Jan 08, 2016 4:36 pm

inkfalcon wrote:https://www.dropbox.com/s/4ev7ekcecchrg5p/flappyh.capx?dl=0&s=sl


Hi,
now the link worked ;)
I checked your file and you and you made following mistake.

Image

On the start of layout you check if the key exists. That's fine.
But you must setup a condition then "If key xxxxxx exists" and not "on item xxxxx get".

So just make the changes shown on the screen shot above and your save/load function should work.

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
109
S
39
G
31
Posts: 1,175
Reputation: 29,314

Post » Sat Jan 09, 2016 8:49 am

tanx andy :)
B
14
S
5
Posts: 23
Reputation: 1,070

Post » Sat Jan 09, 2016 9:25 am

inkfalcon wrote:tanx andy :)


You're welcome :)

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
109
S
39
G
31
Posts: 1,175
Reputation: 29,314

Post » Wed Jan 13, 2016 3:57 am

I seem to have a problem. I have a fairly simple localStorage high score function that works fun when I run the layout from C2, but when I exported it and uploaded it to chromestore and scirra arcade, it just returns 0, any ideas on how i could fix this? thanks.
B
3
Posts: 4
Reputation: 189

Post » Wed Jan 13, 2016 5:35 pm

setey1 wrote:I seem to have a problem. I have a fairly simple localStorage high score function that works fun when I run the layout from C2, but when I exported it and uploaded it to chromestore and scirra arcade, it just returns 0, any ideas on how i could fix this? thanks.


Hi,
it would help us a lot if you could provide a capx example ;)
Otherwise it's nearly impossible to say what the issue causes.

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
109
S
39
G
31
Posts: 1,175
Reputation: 29,314

Post » Thu Jan 14, 2016 12:46 am

can't give links, but will a picture of the relevant code do?Image
it works fine when I test it, just not when I upload it.
B
3
Posts: 4
Reputation: 189

Post » Thu Jan 14, 2016 2:54 pm

setey1 wrote:can't give links, but will a picture of the relevant code do?Image
it works fine when I test it, just not when I upload it.


Hi,
that's fine. You made a simple mistake.
See following part

Score < HighScore (fine)
HighScore < 0 (this is only true if the score is less than 0 --> Set it to HighScore > 0).

That's why your HighScore will never be saved.

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
109
S
39
G
31
Posts: 1,175
Reputation: 29,314

Post » Fri Jan 15, 2016 7:14 pm

I wish that were the case, but my entire scoring system is based in negative. The score is less than 0
B
3
Posts: 4
Reputation: 189

Post » Fri Jan 15, 2016 7:32 pm

setey1 wrote:I wish that were the case, but my entire scoring system is based in negative. The score is less than 0


Sorry I didn't know that you are working with negative scores. I rebuild your case but with positive scores and it works fine on my end.
You can check out the capx over here.

LocalStorage - HighScore Capx

Maybe you can find the issue with my example. Otherwise add the Browser plugin and Alert the current value saved in the local storage and so on (for debugging).

Regards
Andy
Image Image iTunes: Match3 | Google Play: Match3
B
109
S
39
G
31
Posts: 1,175
Reputation: 29,314

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 21 guests