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: 338
Reputation: 7,424

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
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

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 Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

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
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

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: 338
Reputation: 7,424


Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, Ashley, Elliott, R0J0hound, Televangelist and 17 guests