Question about localstorage 'set item' action

Get help using Construct 2

Post » Thu Nov 10, 2016 5:07 pm

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
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Thu Nov 10, 2016 6:46 pm

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

http://www8.zippyshare.com/v/lMXzxvFU/file.html
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Thu Nov 10, 2016 7:08 pm

PixelPower wrote: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.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, jorgmaquoi, Rable, unicornspitfire and 11 guests