How do I reset all static variables?

Get help using Construct 2

Post » Sun Jun 15, 2014 8:10 am

Maybe I'm sleep deprived, but I don't believe there's an easy way to reset all static variables, as there is with globals.

Why do I need to do this? Many of my "global" variables are actually static variables in an 'Every Tick' (which I use to limit their scope to the event sheet they belong in). Now, just as I can reset global variables, I need to reset static variables. What should I do?

I would hate to store each variable in a key and reload. There's gotta be a better way! Any ideas?
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Sun Jun 15, 2014 12:02 pm

Maybe you can use the function object?

on function "resetVariables"
- set variable x to ??
- set variable y to ??
- set variable z to ??

Then call the function each time you need to reset the variables.
B
6
S
1
Posts: 41
Reputation: 762

Post » Sun Jun 15, 2014 10:14 pm

Because they are static variables, the Function object won't be able to access all the static variables that are spread across events.

EDIT: Nvm, of course it can! Function is a trigger that can be placed in multiple places. I was running on very low sleep :P
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 56 guests