Resetting one of different Global Variables

Get help using Construct 2

Post » Sun Apr 20, 2014 11:21 am

Hi:

Do you know if it's possible to reset just one of different Global Variables?

For example, in a platform game: you have Lives and Collectibles in the levels. Both are Persistent objects with Global Variables. After the player dies, you have to Reset the Lifes but not the Collectibles, as once it's taken it doesn´t have to appear anymore.

Thanks in advance.
B
10
S
2
Posts: 36
Reputation: 824

Post » Sun Apr 20, 2014 12:07 pm

@Ofris - yes, you have complete control over Global variables. You can always use the System->Set Value action.
B
33
S
7
G
8
Posts: 312
Reputation: 8,528

Post » Sun Apr 20, 2014 1:30 pm

Hi Manley23:

Thank you for your answer. I can´t solve it with System-> Set Value action. Do you know if I can apply System -> Reset global variables to just one Global Variable?
B
10
S
2
Posts: 36
Reputation: 824

Post » Sun Apr 20, 2014 3:18 pm

@Ofris - I don't think the global reset action is just for one variable. But, can you explain further why you can't just Set Value on the Lives to change it back to 3 or whatever but keep the Collectibles value the same so it works?
B
33
S
7
G
8
Posts: 312
Reputation: 8,528

Post » Mon Apr 21, 2014 10:36 am

Hi!

I can Set Value on Lives so the Player always Starts with 3 Lives after Game Over.

But as the Life item (which adds +1 to Life Global Variable when the Players touch it) is Persistent, when the Player starts a new Game the Life items won´t appear. That is why I need to keep the Life item Persistent but reset it each time you start a new game. Maybe the Reset Variables was not the better solution.

I don´t want to take you more time :) Thank you for your help. If you know how to do it please tell me, but don´t worry if you have to spend more than two minutrs trying to figure it :)

Thanks!
B
10
S
2
Posts: 36
Reputation: 824

Post » Mon Apr 21, 2014 2:58 pm

@Ofris - yeah, I think you almost have it done. Just put in your "Start New Game" code to reset all variables, otherwise only reset the Player Lives on Game Over.
B
33
S
7
G
8
Posts: 312
Reputation: 8,528


Return to How do I....?

Who is online

Users browsing this forum: alextro, stevenode and 7 guests