[SOLVED] How do I Restart a layout from another layout

Get help using Construct 2

Post » Tue Sep 22, 2015 1:48 pm

Is it possible to restart a layout from a different layout?

My problem is that after my player dies I have a function (see picture)

Image

but the problem is after my functions are activated if my player presses the button to go to the main menu and then goes back to the game layout, then the functions are still active, for example the bullet behaviours are still disabled, the player will not move but if I could restart the game layout from my menu layout then everything would be reset again.

Does anyone have any ideas or solutions

Many thanks
Last edited by uzumiapps on Tue Sep 22, 2015 2:48 pm, edited 1 time in total.
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Tue Sep 22, 2015 2:09 pm

You are probably using global variables which are not reset..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 22, 2015 2:14 pm

You can't. Basically if you switch from layout A to layout B then layout A do not exist anymore. Everything on that layout (if not set to global) is destroyed and unloaded from memory.

"if my player presses the button to go to the main menu and then goes back to the game layout, then the functions are still active"

hard to tell without looking at your events, but this should not have happened. If you create a bullet (behavior ON by default) on game layout and set its behavior to OFF by some event then when you go to main menu this bullet don't exist anymore (if it's not set to global).

what you are saying here look like your player is a global object, and if that's true then you will need to manually reset all of his states, behaviors etc.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Tue Sep 22, 2015 2:47 pm

@LittleStain @shinkan thanks for your help, it appeared to be the groups in the function not resetting so I copied all the groups from the function and went to the title layout and pasted them under the button and changed them from disabled to activated

Image
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Tue Sep 22, 2015 3:07 pm

Hi,
Could you please tell me how to paste events in the comment box as you did?
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Tue Sep 22, 2015 3:59 pm

sudeep98 wrote:Hi,
Could you please tell me how to paste events in the comment box as you did?


you mean how to show an image on the forum?

upload your image to the internet somewhere and in the full editor put the link between the [img]-tags
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 22, 2015 4:17 pm

@jaytrott86 True. Groups and layers do not resets.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Tue Sep 22, 2015 5:47 pm

LittleStain wrote:
sudeep98 wrote:Hi,
Could you please tell me how to paste events in the comment box as you did?


you mean how to show an image on the forum?

upload your image to the internet somewhere and in the full editor put the link between the [img]-tags


Thanks
B
24
S
7
Posts: 337
Reputation: 2,224


Return to How do I....?

Who is online

Users browsing this forum: angryscientist, corporatedrone and 31 guests