0 Favourites

Sub Events Question

  • Do sub-events always run in serial (top-down) and wait for each other to finish in the same order?

    i.e, do bottom sub-event wait for top sub-event to finish


    main even( condition1 )

    sub-event1( condition 1.1 )

    sub-event2( condition 1.2 )

    sub-event3( no-condition - only action)

    if sub-event2 condition is met and its actions are CPU hungry, will sub-event3 run before sub-event2 finishes or wait for it?

  • Events are read vertically from top to bottom, every frame. An event isn't checked until it finishes checking previous events.

    So subevent 3 will be checked after subevent 2.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I beg to differ. Sorry for bumping this not-so-old topic, but I see everywhere people saying that sub-events are run one after the other, which appears to be wrong. And I wish it'd be true, otherwise I wouldn't have all those problems...

    So far in my experience, sub-events will run one after the other only if every sub-event is a sub-event to the previous one. It won't work if they are all sub-events of one main event. And that's hard to deal with when using loops. The attached .capx file shows what I mean.

    If anyone knows how to overcome that, I'm all ears.

  • okay Kan you've got me thoroughly confused now.. Somebody come along and explain this please?

  • Kan

    The issue you are having has to do with C2s inability to pick objects in a sub-event immediately after creation. It isn't a sub-event issue in general, only in this specific case. The behaviour is (unfortunately) expected, had had been discussed many times on the forum. Event 4 is being run sequentially, the Sprite object just can not be picked yet.

  • Is there also such an exception with the 'Wait' action?

  • Wait IS asynchronous. Wait takes all actions below it AND its sub-events and calls them after the time has expired. Event 3 is not in the Wait scope so it will get called immediately (in this case, immediately after the 1 second wait, overriding anim2). The last Wait call in event 2 does nothing.

  • Alright, thanks. I'm happy now I know those two things.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
353 32,097
yojona's avatar
Unread sticky
192 1,337,453
Kyatric's avatar
Kyatric Construct Team Support
Unread hot topic Locked topic
67 21,585
Ashley's avatar
Ashley Construct Team Founder