How do I add current score to total score and save it?

Get help using Construct 2

Post » Thu Jul 17, 2014 7:20 am

@Minor That also sadly did not help.

On the very first layout it loads the total, no problem with that. But when I switch to the next layout with the count increasing(displaying points received per second), it always starts back from 0.

I need it to take into account the number saved in the previous layout, which it is not doing.


On a side note, I know I really need to download the newest latest release, but my net speed is really bad. I will download it soon though.

Till then can anyone help me with this?

Please?
B
4
S
1
G
1
Posts: 33
Reputation: 714

Post » Thu Jul 17, 2014 9:18 am

Just from my head, so there could be some unclear stuff:

Add a global variable TotalScore

On start of layout 1
if local key "Total" exists set Totalscore to int(Total)
if local key "cash" exists add int(cash) to total score
- set text to total score
if local key cash does not exist
- set text to no score

on going to next layout save totalscore to webstorage local key "Total"

Remember to reset global variable currentscore to 0 if you want to start over on the next layout..
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 » Sat Jul 19, 2014 5:45 am

@LittleStain, I did not understand any of that, and even though I tried your method out, it did not work.

Can someone please help?

I really need this.
B
4
S
1
G
1
Posts: 33
Reputation: 714

Post » Sat Jul 19, 2014 6:15 am

You aren't actually loading the integer back, only the text to display. Add (on start of layout):

Set CurrentScore to int(WebStorage.LocalValue("Cash"))
ImageImageImage
B
71
S
22
G
257
Posts: 3,789
Reputation: 142,694

Post » Sun Jul 20, 2014 6:56 am

@blackhornet, OMG, that actually worked.
Thank you so much. :)
B
4
S
1
G
1
Posts: 33
Reputation: 714

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests