Question about localstorage 'set item' action

0 favourites
  • 3 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • On my storage event sheet i have the event:

    System > StarsCount greater than "starscount_key" - localstorage > set item "starscount_key" to StarsCount

    Does this mean that at any time the StarsCount is greater than "starscount_key" localstorage will set it to the value of the StarsCount?

    In this case would it be like having it set to an 'every tick' event? Since the player will be able to score stars almost every tick, thus increasing the StarsCount almost every tick. (I know not to use a localstorage with an every tick action).

    The reason i ask, i have a _gameplay_Game Over event sheet that is included with other _gameplay___event sheets, and when the ball (player) is destroyed there are a lot of actions that run, including at the bottom of these actions is the: localstorage > set item "starscount_key" to StarsCount.

    Do i need the duplicate action on the _gameplay_Game Over event sheet if i have it already in the storage event sheet? Will it automatically set the StarsCount value at the time the player dies?

    Also, how do i set the localstorage to the power-up? Since i can not use a greater than, the number of available power-ups will go up/ down. At times there may be 10 available, other times there may be only 4 available. Or there may be zero available.

    Would i need to have 2 different events?:

    System > ShieldCount greater than "shieldcount_key" - localstorage > set item "shieldcount_key" to ShieldCount

    AND

    System > ShieldCount less than "shieldcount_key" - localstorage > set item "shieldcount_key" to ShieldCount

    Thanks for any help with this conundrum

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok check this out it should simplify local storage for you.

    http://www8.zippyshare.com/v/lMXzxvFU/file.html

  • Ok check this out it should simplify local storage for you.

    http://www8.zippyshare.com/v/lMXzxvFU/file.html

    PixelPower Thanks for the reply. I've followed that capx before, don't know where i got off track. So i managed to fix a couple of things. My problem now is trying to get the power-up to save and spawn correctly. It keeps going back to zero on Game Over.

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