running sub events in sequence

0 favourites
  • 6 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Sorry if this has already been posted in the forums, I don't mind it being delted.

    I am wondering what is the best way to run sub events in sequence. Such that the second one starts after the first completes. I'm using sub events because they need to contain seperate conditions. This would be similar to using two if statements one after eachother in scripted code.

    For example:

    <img src="http://i.imgur.com/1pUaBsG.png" border="0" />

    What I would want to happen is for the program to check the first sub events conditions (which there are none) then wait 1 second then change the text to "ONE" then immediately after run the second sub event checking its conditions (none here either) and then immediately change the text to "TWO"

    Instead what happens is it changes it to "TWO", then waits 1 second and changes it to "ONE"

    So it seems seperate sub events don't execute in sequence, which is good for most situations, but how do i do that?

    Here is my proposed solution, and I think its the correct one that will allow seperate conditions to run in order.

    <img src="http://i.imgur.com/21YPb2R.png1" border="0" />

    If anyone thinks there is a better way please let me know.

  • Try Construct 3

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

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

    <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/subevents1.PNG" border="0" />?

  • Or...

    <img src="http://blackhornettechnologies.com/Construct2Stuff/subevent.jpg" border="0" />

  • well those would both work for the simplified example. but their still just running non sequential sub events.

    [edit] yes blackhornet with your example the second sub event is forced to run after the first because its a sub event OF the first, but I want them both to be sub events of the main event. [/edit]

    The reason I'm asking this question is what if I have a really complex operation that takes a few miliseconds to complete? The second sub event might begin before the first one completes. I was using the wait action to symbolize this.

    I really think functions are the way to force sub events to execute in sequence.

  • You can't use Wait to simulate this. Wait spawns off and runs whatever is underneath IT in parallel. You should be fine with what you are doing. The sub events are sequential.

  • OK thanks.

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