How do I stop a previous layout?

1 favourites
  • 3 posts
  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)