Issue with saving purchased item after exit - In-app store

Get help using Construct 3!

Post » Thu Oct 19, 2017 6:18 pm

I'm working on an in app store for my game and have set it up so that each item purchased lasts for 3 turns.

I'm using Global Variables to trigger the item etc, and wanted to save these values so that the user can continue using the purchased item after exiting the game, as long as the item is still active.

The issue i'm having is when i purchase one of the items (you can only purchase one item at a time) and exit the game, upon loading it back, all of the items are checked (meaning they're all active) rather than just the one i purchased.

I'm struggling to get this to work as i've tried many different methods. The latest one i've tried is by having 3 seperate local keys for each item but that hasn't worked either.

I'm using Webstorage to store values, i know it depreciated but it still works fine for me with my other games.

I've provided a capx and really hope someone can help me out with this.

https://www.dropbox.com/s/blxo13ofiy1oyhn/Example.capx?dl=0

Thanks
Image ImageImage
B
10
S
4
G
1
Posts: 110
Reputation: 1,718

Post » Thu Oct 19, 2017 11:14 pm

You're resetting the global variables but not resetting the keys in webstorage so they still exist as 1, so on your 'on start of layout' checks it sets the item global vars to 1 which sets the arrays to 1 which enables the ticks etc. If you add actions in your items > 3 reset event to also reset the webstorage values to 0 you'll see they are being cleared now.
B
53
S
21
G
95
Posts: 2,452
Reputation: 56,119

Post » Fri Oct 20, 2017 10:05 pm

@plinkie

Got it working now :)

Thanks!
Image ImageImage
B
10
S
4
G
1
Posts: 110
Reputation: 1,718


Return to How do I...?

Who is online

Users browsing this forum: dioking, LaurenceBedford and 0 guests