How do I get layout switching to act as expected.

0 favourites
  • 6 posts
From the Asset Store
Toggles Dials Switches and Alerts ! A foundational sound grouping of Analog type switches and Steampunk effects
  • When I test a layout by itself, everything in the layout seems to work as expected, but when I test the whole project, layouts seem to do strange things.

    Is there a reason layouts behave differently when testing the whole project and moving and transitioning through the different layouts, as opposed to testing just the layout on its own?

  • To really understand what is going, we would need to know what "strange things" are happening. However, here are a couple things to look for.

    Are you using global variables that get modified in a previous event? Global variables persist between layouts.

    Are some of your events in the layouts referencing ticks passed? If they are, many ticks have already passed in the system by the time the layout starts. This could cause items in the layout to be in a different state than you expect them to be in.

    I have found it is always good to have an on start of layout event to set everything to the beginning state for that layout. Simply added this type of event may fix the problem for you.

    I hope that gets you what you need and, good luck with your project.

  • Oh I see. Yes. I'm using things, like... Spawn object every X seconds

    and sometimes you'll go to level 2... and the spawns will happen too early

    I'll try adding the "on start of layout" event to these parts

    thank you

  • For the every x seconds, you should add a variable to the layout storing the start time of the layout and do every x seconds after the stored time, not the game time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok

    yeah... I was realizing you can't combine "at start of layout" and "every x seconds"

    thanks again

    I'll try that then

  • I thought setting a condition like...

    only do the spawn actions when the object is not on the screen would be a clever way of simplifying this...

    but it doesn't seem to work... things still spawn as the layout starts when using every x seconds... even with this condition applied

    the problem I was trying to avoid was enemies spawning right next to the player as soon as the layout starts

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