How do I use the LocalStorage Plugin?

Get help using Construct 2

Post » Thu Jun 18, 2015 6:20 pm

Yes, min. localstorage "get item", because if not, "on item get never" trigger.
Or you do "set item" from any other condition, for example a button click.

action and reaction, if there is no action there never will be a reaction. Law of nature. :D

I think its better for you, you make an seperate sheet for this. and incude it to both other.
Last edited by deathangel1479 on Thu Jun 18, 2015 8:04 pm, edited 1 time in total.
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
11
S
4
G
1
Posts: 158
Reputation: 1,328

Post » Thu Jun 18, 2015 6:22 pm

I will make you a sample, but will take some minutes.

Settings
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
11
S
4
G
1
Posts: 158
Reputation: 1,328

Post » Mon Jun 22, 2015 9:59 pm

Hey AndreasR!

First, thank you for sharing your knowledge.

I'm pretty disapointed. I followed your tutorial closely and I would fail something, i guess. When I test my game, my text object return to initial value if I reload my layout. I tried to put a "coin counter system" in your example, and the same thing happend.

What am I doing wrong? Could you post an example which can show us how to store value and add it to text object on layout loading?

Thank you for reading!
B
7
S
1
Posts: 64
Reputation: 585

Post » Tue Jun 23, 2015 11:30 am

norab wrote:Hey AndreasR!

First, thank you for sharing your knowledge.

I'm pretty disapointed. I followed your tutorial closely and I would fail something, i guess. When I test my game, my text object return to initial value if I reload my layout. I tried to put a "coin counter system" in your example, and the same thing happend.

What am I doing wrong? Could you post an example which can show us how to store value and add it to text object on layout loading?

Thank you for reading!


I'll update the sample file when I'm home ;)
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

Post » Wed Jun 24, 2015 5:34 am

norab wrote:Hey AndreasR!

First, thank you for sharing your knowledge.

I'm pretty disapointed. I followed your tutorial closely and I would fail something, i guess. When I test my game, my text object return to initial value if I reload my layout. I tried to put a "coin counter system" in your example, and the same thing happend.

What am I doing wrong? Could you post an example which can show us how to store value and add it to text object on layout loading?

Thank you for reading!


Sorry I couldn't attach the file to this post or to my tutorial.
You can download it here: https://shatter-box.com/?p=11326
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

Post » Wed Jun 24, 2015 10:17 am

Great!

And as a bonus, I learn to use function object!

It would work to very well for katzin's tests, because it works for multi layout project...

Thank you very much AndreasR ! :D
B
7
S
1
Posts: 64
Reputation: 585

Post » Wed Jun 24, 2015 2:19 pm

Thanks a lot Death and Andreas for your support :D
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Thu Jun 25, 2015 3:15 pm

@norab @katzin
You're welcome, I'm glad to help :)
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

Post » Tue Jul 28, 2015 8:27 pm

I'm trying to use this to make a high score system, here's what i have so far.

On start of layout: Check item "HighScore_Key" exists

On item "HighScore_Key" exists: Get item "HighScore_Key"

On item "HighScore_Key" get: Set HighScore to LocalValue.ItemValue

On item "HighScore_Key" missing: Set item "HighScore_Key" to TotalDistance (which is the current score value)

Every tick: highscoretext: Set text to HighScore (which is the global variable)

It starts out like usual but then when the game ends, the number goes right back to 0. Do you know how to fix this?
Thanks for any help!
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Wed Jul 29, 2015 4:23 am

firezombie444 wrote:I'm trying to use this to make a high score system, here's what i have so far.

On start of layout: Check item "HighScore_Key" exists

On item "HighScore_Key" exists: Get item "HighScore_Key"

On item "HighScore_Key" get: Set HighScore to LocalValue.ItemValue

On item "HighScore_Key" missing: Set item "HighScore_Key" to TotalDistance (which is the current score value)

Every tick: highscoretext: Set text to HighScore (which is the global variable)

It starts out like usual but then when the game ends, the number goes right back to 0. Do you know how to fix this?
Thanks for any help!


Can you attach a capx example?
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 46 guests