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

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • plinkie

    Got it working now

    Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)