Help with "Every X seconds" between layouts.

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello Everyone,

    I need your help to resolve this problem.

    I have two layouts: Layout1 and Layout2 .

    In the Layout1 you can select missions, meanwhile in Layout2 you play.

    The problem I have is the following:

    In the Layout2 I have Every 5 seconds an enemy appears.

    But, if you stay in the Layout1 without select any mission and the 5 seconds already passed when you enter to layout2 the enemy is there...

    The 5 seconds pass meanwhile you are in the Layout1.

    How can I do that the "Every 5 seconds" only works when you are in the Layout2 ?

    Thanks in advance and best regards.

  • Have a variable that is set to 1 only when the player is on that layout. So you would make an event that changes it to 1 on start of layout, then give the spawning event another condition that tells it the variable needs to equal 1

  • Hello EncryptedCow,

    I tried with the global variable with different value in the layouts and doesn't work.


    On Start of layout set variable=1

    if (variable=1)   every X seconds


    On Start of layout   set variable=2

    if (variable=2) every x seconds

    I also tried comparing variable, values (layoutName), and other conditions such as layout end loading...

    But, nothing works, the "every x seconds" just ignore those ones.

    It seems that from the start of the game without matters what layout is, the "every X seconds" is always running.

    Any idea?

  • Hi,

    I Tried a couple other things such as setting group and...

    didn't work....

    Anyone else was dealing with this issue before?

  • Are both layouts using the same event sheet? If so, consider creating one event sheet for each layout. Then it can't add to the variable unless it's on layout2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have the same problem in spawning enemies, but in my case I can�t put in differents style sheets, because happens when I restart level.

    Shouldn�t restart layout or on layout start, restart the time in the level?

  • Hello Julian,

    What I found is when you use the Every X seconds, does not work with the create object or spawn action.

    Instead I created a variable that every X seconds add one.

    I mean,

    Variable time= 0

    Every X seconds - > Add 1 to Time.

    Then If I want to create an enemy every 5 seconds for example.

    If time = 5 create object (or spawn).

    And this works perfect.

    Best Regards

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