Reset Function

Discussion and feedback on Construct 2

Post » Fri Oct 28, 2011 9:25 am

Hey Ashley / Tom, could we get a System -> Reset / Reinitialize Function of some sort?

So a layout can be restartet with the values it would have if the game / layout hasn't been played yet?

Examples: System -> on start of layout -> reinitialize(gamelayout)
System -> on start of layout -> reinitialize(optionslayout)

I went the easy way in NEON and just reloaded the page because i lost track of some variables and groups and didn't have an overview anymore of what changed and when... i guess im not the only one with this problem and "bigger" projects.

I know that i could create an event on game over that goes through all variables /groups / etc. and resets them but i think a function in the runtime itself to do this would be nicer and easier for the users :DIze2011-10-28 09:26:45
B
33
S
6
G
7
Posts: 339
Reputation: 7,426

Post » Fri Oct 28, 2011 2:44 pm

Everything should reset except global variables. So would something to reset all global variables be enough?
Scirra Founder
B
383
S
225
G
86
Posts: 24,119
Reputation: 190,551

Post » Fri Oct 28, 2011 3:59 pm

The main use of a global variable is that its passed to each layout, and every object has instance variables, so I don't really see the point of resetting globals.
Image ImageImage
B
166
S
49
G
154
Posts: 8,106
Reputation: 100,233

Post » Fri Oct 28, 2011 4:22 pm

Think Binding of Isaac. if all the powerups were stored in global variables to keep as you progress, but you want them to go away when the player dies.
B
32
S
3
G
2
Posts: 57
Reputation: 3,692

Post » Fri Oct 28, 2011 6:19 pm

Surely that's the whole point of initialization.

On level start, variables - global or instance - should be setup by the programmer accordingly.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,194
Reputation: 54,293

Post » Fri Oct 28, 2011 8:14 pm

@Ashley well if the global variables are the only thing that aren't reset when the layout is changed, I guess its not needed.
B
33
S
6
G
7
Posts: 339
Reputation: 7,426


Return to Construct 2 General

Who is online

Users browsing this forum: AekiroStudio and 6 guests