How do I make my global variable to NOT resetting

Get help using Construct 2

Post » Sat Jul 08, 2017 3:12 pm

Okay so, I'm making a simple piggy bank application. There's plus and minus button. I made a global variable to store my savings and the plus button will add $1 to my savings but every time I quit the game/app(what ever you want to call it.) its resetting the variable to 0. Which the global variable initial value. Can I just declared the variable and not adding any initial value? :? :? :?
B
9
S
1
Posts: 14
Reputation: 510

Post » Sat Jul 08, 2017 3:36 pm

You have to keep the values of the variable in local storage if you want to remember its state after you close/exit the game, otherwise it will always reset to the initial value.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Sat Jul 08, 2017 3:49 pm

imhotep22 wrote:You have to keep the values of the variable in local storage if you want to remember its state after you close/exit the game, otherwise it will always reset to the initial value.


How to that may I ask..... I'm so sorry. Really, really sorry... :oops: :?:
B
9
S
1
Posts: 14
Reputation: 510

Post » Sat Jul 08, 2017 4:11 pm

See here the manual for local storage
https://www.scirra.com/manual/188/local-storage

See this post which had the same question which I helped solving
viewtopic.php?f=147&t=192946&p=1130941#p1130941

Also here is a screen for saving high score in an array which I used in my game
https://postimg.org/image/enyi4lp9x

I hope this will clear things, it will take you a bit to get used to using local storage, after that its easy.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367


Return to How do I....?

Who is online

Users browsing this forum: namaewayukidesu and 20 guests