How do I make the layout restart when the layout is exited

Get help using Construct 2

Post » Mon Aug 04, 2014 11:15 pm

So basically i am creating a level in which you click the continue button when time runs out and depending on if you unlocked the next level you may need to re do the same level however when i go on the level again all my variables are the same as my last play and the end screen is still showing, i was wondering how i could create a system that would check for when the layout is exited or even entered and then it uses the system.restartlayout,
Thanks :D
A box isn't a box without 6 sides.
B
18
S
3
Posts: 26
Reputation: 1,785

Post » Mon Aug 04, 2014 11:28 pm

Use a variable to track the state. If they exit set a variable to 1 or whatever value you want. On the continue button click event check the variable and then you can choose to restart the layout or go to the next one based on that value.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573

Post » Mon Aug 04, 2014 11:51 pm

Thank you so much :)
A box isn't a box without 6 sides.
B
18
S
3
Posts: 26
Reputation: 1,785

Post » Wed Aug 06, 2014 11:44 pm

BluePhaze wrote:Use a variable to track the state. If they exit set a variable to 1 or whatever value you want. On the continue button click event check the variable and then you can choose to restart the layout or go to the next one based on that value.


Ok so a little update here, I have set it up that way but now when i join the main events that make the game a game don't run
A box isn't a box without 6 sides.
B
18
S
3
Posts: 26
Reputation: 1,785

Post » Thu Aug 07, 2014 12:10 am

I haven't fixed it but i have come up with a new way of doing it, if anyone can tell me how to delete posts i would be grateful :)
A box isn't a box without 6 sides.
B
18
S
3
Posts: 26
Reputation: 1,785

Post » Thu Aug 07, 2014 12:51 am

On exiting set the variables back to the values you had at the start.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Thu Aug 07, 2014 4:15 pm

As @TheDom said, if you reset the values of the variables in your goTo layout event you should be fine. For example:

If Done = 1
Set Done = 0
GotoLayout = WhateverLayout
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573

Post » Thu Aug 07, 2014 4:16 pm

@TheEggMaster Go to any of your posts and you should see a little pencil icon in the upper right corner. That lets you edit the post. You can delete your last post, not sure about deleting previous posts though.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests