How do I Reset global values except of one

Get help using Construct 2

Post » Thu May 11, 2017 9:50 am

Hello there!

Ive a question:

On layout start i have a sound which introduces the gameplay. If the player is gameOver he can restart the game. Because there are many variables and position changes - iam using restart layout and reset global variables.

If the layout restarts the introducing sound shouldnt appear again. So i would need to reset all variables, except of the "playSoundAgain" variable.

Any ideas?
B
11
S
2
Posts: 165
Reputation: 1,127

Post » Thu May 11, 2017 10:10 am

@Congrats2u

Use Local Storage for anything you want to persist, like the "playSoundAgain" variable, save it before you reset the variables and load it at the start of the layout before you do anything else.
Find all the Construct 2 games that were on Steam Greenlight here
B
37
S
10
G
7
Posts: 489
Reputation: 7,078

Post » Fri May 12, 2017 7:02 am

@OddConfection

Thank you i will try this out!
B
11
S
2
Posts: 165
Reputation: 1,127

Post » Fri May 12, 2017 10:40 am

@Congrats2u

Another way is to use a sub event with a local variable and this chain of actions:

Set localVar to globalVarA
Reset all global variables
Set globalVarA to localVar
B
22
S
9
G
4
Posts: 481
Reputation: 4,344


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 46 guests