How do I solve a big problem with WebStorage?

Get help using Construct 2

Post » Mon Jun 08, 2015 3:03 pm

Hi,
I made a big project ( 600 events) with a 35 layouts and I made something wrong.
The game is on Google Play.
So the "big problem" could be also named as money bug.
So you have in-game money and if you buy something it substracts from the money, all ok here but if you go to the menu and press start and after you return to the menu the money you spend with that ball upgrade are comming back. ( the upgrade + money comes back like before you bought them)
I don't know what i did wrong. I watched everywhere, I'm not so good at webstorage, don't know why, maybe I didn't uderstand it well.
Soo... if anyone could help me with this bug please let me you email belov to send you the project file.
Much Thanks to everyone reads this.
B
11
S
3
Posts: 277
Reputation: 1,395

Post » Mon Jun 08, 2015 6:25 pm

Hi,

You need to check how are you initializing the WebStorage. I assume it is initializing it without checking whether it even exist already or not.

It should be:

If X Webstorage "Money" exist: | Set Webstorage "Money" to 10000

This way, it will make the Webstorage called "money" to 10000 only if it does not exist. (Which means, only one time even if you come back tomorrow).

Hope this helps.
B
10
S
2
Posts: 107
Reputation: 978

Post » Mon Jun 08, 2015 7:53 pm

@Hasan999
Thank you for your reply,
I don't know i think I made a variable and whenever the variable change save it to localstorage.
Could you help me If i send you the project?
I don't know your reply will help, thanks anyway. :)
B
11
S
3
Posts: 277
Reputation: 1,395

Post » Tue Jun 09, 2015 12:44 pm

@Radulepy Sure, go ahead. Email me your capx: hasan555x at gingermail.com

EDIT: Changed it :P thanks
Last edited by Hasan999 on Thu Jun 11, 2015 11:11 pm, edited 1 time in total.
B
10
S
2
Posts: 107
Reputation: 978

Post » Tue Jun 09, 2015 3:13 pm

@Hasan999
before please I think i got it ( 3 days :( )
So what is the exact code to save a varaiable when changed/on exiting the layout and when i reenter the layout, to load that variable?
B
11
S
3
Posts: 277
Reputation: 1,395

Post » Tue Jun 09, 2015 4:13 pm

Hasan999 wrote:@Radulepy Sure, go ahead. Email me your capx: hasan555x ~@~ gmail ^. ^ com


You might want to change that to something like:

hasan555x *at* gmail dot com

The web-crawling bots will find your email, and you will get armadas of spam...
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822

Post » Tue Jun 09, 2015 5:09 pm

@Hasan999 Sent You
B
11
S
3
Posts: 277
Reputation: 1,395


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests

cron