How do I reset only one global variable?

Get help using Construct 2

Post » Fri May 19, 2017 8:09 pm

hi, i need reset one or two global variables, for example, if the time is 0 the global variable "life and time" reset
B
22
S
4
G
2
Posts: 55
Reputation: 2,220

Post » Fri May 19, 2017 8:14 pm

@Swivels

One way is to create a couple of extra globals e.g. lifeInit and timeInit, and set them to the reset values.
When you want to reset "life" and "time" set them to lifeInit and timeInit.
B
22
S
9
G
4
Posts: 476
Reputation: 4,327

Post » Fri May 19, 2017 8:38 pm

i understand you, but i forgot that life have 6 global variables (7 in total), for each monster life put the value of the life on te monster on the screen and time only have one (seconds), so i need that when the time be 0 and the moinster have life, only this life reset, because when i destroyed the monster system add 15 seconds more to another monster on screen (in global variable time), if i set the value of "monster1" (example) the monster never lose life.
B
22
S
4
G
2
Posts: 55
Reputation: 2,220

Post » Fri May 19, 2017 8:52 pm

Why do you keep the monster life as a global variable? Never less you can add event that will check if time is 0, then reset all those life variables to what ever value you like.

event system -> compare global variable -> time <= 0
action system -> set global variable -> health1 = 10
action system -> set global variable -> health2 = 10
......etc
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Sat May 20, 2017 3:14 am

I have the solution, thanks friends
B
22
S
4
G
2
Posts: 55
Reputation: 2,220


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Kyatric, Yahoo [Bot] and 3 guests