How do I reset local static variables?

Get help using Construct 2

Post » Tue Oct 10, 2017 9:21 pm

I use local static variables to keep the code short and efficient. When I want to restart a layout so that the player can replay the game exactly as it was, there is no option to reset local static variables, only glocal variables.

No, I don't want to convert every local variable into a global one.

How do I rest local static variables?
B
20
S
9
G
2
Posts: 128
Reputation: 2,976

Post » Sun Oct 22, 2017 7:16 pm

Bump. Major issue.
B
20
S
9
G
2
Posts: 128
Reputation: 2,976

Post » Mon Oct 23, 2017 2:03 am

I don't think there is an easy way to do it.
I recently converted lots of global variables to local static and actually your post made me realize that some of them need to be reset when a new level starts. I had to create several events that reset them to 0 one by one.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :)
B
17
S
9
G
66
Posts: 1,010
Reputation: 36,081

Post » Tue Oct 24, 2017 4:09 am

Well, it would be great if that feature were implemented in C2 soon.

I will surely add this to the suggestions list of C3.
B
20
S
9
G
2
Posts: 128
Reputation: 2,976


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Maako and 4 guests