How do I stop a previous layout?

Get help using Construct 2

Post » Fri Jun 13, 2014 2:40 pm

In my game, I have an intro cutscene of sorts on its own layout. It uses some of the new lighting/shading stuff that was recently added to C2. I added an event for keystroke/mouse click to skip to the layout for level 1 which also uses shadows. The light sources that would have spawned if the intro had continued still get spawned after the level 1 layout loads and they're casting shadows on my objects.

Should I expect everything from the previous layout to be destroyed when I go to the new one, or do I need to add some logic to destroy objects and prevent the light sources from spawning if the intro was skipped?

What I'm doing is calling a function that spawns light sources with "wait x seconds" between each one, and the total run time of that function is about 30 seconds. Is it just trying to finish that function or something or does it really not destroy any of the old layout objects/events when changing?
B
4
S
1
Posts: 8
Reputation: 393

Post » Fri Jun 13, 2014 8:16 pm

All objects that are not global are destroyed after leaving the layout. By default objects are not global, You have to set it's property to make it global.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,293

Post » Sun Jun 15, 2014 6:39 am

I get that. The problem I had was the function was already called and spawning light sources every few seconds. I added a global var for the current layout and added that as a condition for the function event. That fixed it.
B
4
S
1
Posts: 8
Reputation: 393


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests