How do I restart game layer with the same global variables

Get help using Construct 2

Post » Sun Nov 30, 2014 2:56 pm

Hi everyone!
So i'll try to describe what problem i have
I have a "start layout" with three levels of difficulty. Easy, medium, insane (for example), that's three levels are sprite buttons. When you press one of the button it takes you to "game layer" and change global variables for example (time of object's spawn and coin multiplier). default values are 0 in that global variables. So the problem is how to save the same global variables when you press "restart" layer button (for example time of object's spawn = 1.5 sec and coin multiplier x1) because when i hit restart button layer resets ang globals become to 0.
B
2
Posts: 8
Reputation: 166

Post » Sun Nov 30, 2014 3:11 pm

One possible solution is to store the difficulty setting in a Global, then 'initialize' your Layout variables based on the difficulty setting global.

That way, when you restart (make sure not to reset globals), the difficulty setting is still set, and the relevant variables will be correctly initialized.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,555
Reputation: 60,454

Post » Sun Nov 30, 2014 3:22 pm

is there any capx for realizing how to do this? Or some lesson?
B
2
Posts: 8
Reputation: 166

Post » Sun Nov 30, 2014 3:46 pm

,,,,,,,,,,,,,,,,,,,
You do not have the required permissions to view the files attached to this post.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sun Nov 30, 2014 4:00 pm

TY @korbaach
B
2
Posts: 8
Reputation: 166

Post » Sun Nov 30, 2014 6:43 pm

so another question is that possible to split hightscores stored in webstorage on one layer with different difficulty? For example if i scored 10 on easy level save that easy scores to "easy" webstorage and show when character died in the end?
B
2
Posts: 8
Reputation: 166

Post » Sun Nov 30, 2014 9:53 pm

you can use Var_easy_HS for "easy" webstorage..Var_normal_HS for "normal" webstorage.......
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072


Return to How do I....?

Who is online

Users browsing this forum: draiza and 8 guests