How do I local storage

Get help using Construct 2

Post » Wed Nov 18, 2015 1:51 pm

Okay so after hours of looking around tutorials and capx files I am posting this.
I am making a platform game where you have to try and do it as fast as you can. I have 3 levels, and on my level select screen i want to have the fastest times underneath each level icon. However I just cant figure out how to do local storage.
At the moment I am setting my Highscore/fastest time to something REALLY high and then saying If timer is lower than FastestTime set Highscore to Score. I need a way of saving my Fastest time, as at the moment it only says the Previous time.

Thanks :)
B
5
S
1
Posts: 37
Reputation: 463

Post » Wed Nov 18, 2015 1:58 pm

What tutorials have you tried and what part of them didn't you understand?

This one even has a capx you can download..

Also, why a second topic with the same question?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 19, 2015 10:07 am

Thanks for the reply,
I'm not really a programmer and don't fully understand local storage.
All of the tutorials I copy never seem to work for me. Getting kind of frustrating!
Thanks for your link, although the examples use web storage.
B
5
S
1
Posts: 37
Reputation: 463

Post » Thu Nov 19, 2015 11:40 am

All I need is for Local storage to save my score when It is lower than my current high score/time.
B
5
S
1
Posts: 37
Reputation: 463

Post » Thu Nov 19, 2015 1:13 pm

The example uses webstorage?
What example?
You can't be talking about the capx attached to the local-storage tutorial, for it ,ofcourse, uses local-storage..

you just need this:

on start of layout
>localstorage check item "highscore" exists

localstorage "highscore" exists
> system set global variable Highscore to localstorage.itemvalue

on game ended (you should know which triggered event you could use for this in your capx)
System compare two values : Score < Highscore
> localstorage set item "highscore" = Score

The tutorials explain this much better and in greater detail..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 19, 2015 2:24 pm

Once again you have helped me out Little Stain,
With a few tweaks I got this working! :D
B
5
S
1
Posts: 37
Reputation: 463


Return to How do I....?

Who is online

Users browsing this forum: LeirSchiessl, marcoscodas, raulcg1981 and 11 guests