How do I know when a function has ended?

0 favourites
  • 5 posts
  • Or maybe a foreach? I have an issue on my project ; a function or a condition is called after a function but this one takes some time to complete, so the next function called fails unless I put a system wait into it (even a wait of 0.0001 second works, but it will fail if I wait 0 second).

    I'm pretty sure the problem comes from this, so I'm wondering how I can know when a function or any condition/event has ended. Any idea?

    I know I already opened a thread about my issue but my current question is more specific, so that's why I'm creating a new one.

  • Normally a for each ends like.. this (since Events are read from top to bottom):

    And a function is over.. well juts after it's done, I do not know how to explain really, since the function isn't done in parralels, you call the function, it executes it, then it continue where it stopped previously, like if you just pasted the function inside an event (however functions and wait do not mix up that well it seems).

  • If it works like this I guess my problem is not what I thought, which means I'm still stuck on this nasty issue. >: ( I have no other system wait of any kind in my events so I really don't understand why my events work the right way only if I use a system wait.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It may be a stupid suggestion, but instead of having the for each inside the function, maybe have it outside, before calling it

  • Answer added to initial thread.

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