0 Favourites

How do loop and subevent work Together?

  • If I use a loop:

    for x from 1 to 4

    and I have a subevent below it

    how does the flow go?

    Is it executing the parent's event 4 times, then it goes to the subevent?

    or every x it will execute the parent and the subevent?

    ---------------------------------------------------

    If I use WHILE condition and other condition,

    is it the same if I use WHILE with a subevent?

  • Yep, the same question by me, this is where i'm stuck right now.

    How the flow of sub-event goes inside a loop ?

    [attachment=0:344v56br][/attachment:344v56br]

    This example isn't working, index just keeps increasing by 1 endlessly

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Yep, the same question by me, this is where i'm stuck right now.

    How the flow of sub-event goes inside a loop ?

    [attachment=0:2ou11yew][/attachment:2ou11yew]

    This example isn't working, index just keeps increasing by 1 endlessly

    Your entire loop is running maybe 60 times a second. You need a condition to make it only run once. Like a "System: Once while true" above it, or put it under "on start of layout", etc.

  • If I use a loop:

    for x from 1 to 4

    and I have a subevent below it

    how does the flow go?

    Is it executing the parent's event 4 times, then it goes to the subevent?

    or every x it will execute the parent and the subevent?

    ---------------------------------------------------

    If I use WHILE condition and other condition,

    is it the same if I use WHILE with a subevent?

    Having subevents under a loop doesn't alter the way the subevents work, they are just repeatedly executed as per the loop conditions.

  • I had the same problem, as I was trying to use code from languages such as Python..

    The easiest way I have found is to use the loopindex as the controlling factor and check to see if that has reached the upper value of the loop.

  • You don't have to check anything. But you MUST use the loop inside an event like Every X seconds or another condition. Because using kjust the loop means that every tick the loop will be run again forever.

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