Problem: "Wait 0" second between function to make it work

0 favourites
  • 6 posts
  • I use Construct since 2014, I remember when I confused and try to configure why my functions not working properly for a few days.

    Then I search in the forum, I see someone post to put "Wait 0 second" between it's function, and it's work.

    It's a weird bug and solution, but working, sadly this bug still happened even now on Construct 3. I never had similar problem when developing JS game.

    If I remove "Wait 0 second", "generate_road" and "fix_road" will be called even Events above is not completed.

    And if I remove "Wait 0 second" between "generate_road" and "fix_road", "fix_road" will be called even "generate_road" is not completed.

    I'm obsessed to create a clean & simple code or blocks, since it will be easy to maintenance, "Wait 0 second" between functions is not a clean structure, I bet it's also create confusion for new user when create a bit complex looping events.

    Note: there is no wait or call another functions inside "generate_road" and "fix_road" function, so it's just a straight looping array to spawn sprite at specific coordinate.

    This type of bug can break game logic, without error reporting.

    Don't get me wrong, I love Construct

  • don'T do that. It'S because when you "create" an object it's not available for events until the next tick unless the events are right below the "create", they'll be queue with it

  • don'T do that. It'S because when you "create" an object it's not available for events until the next tick unless the events are right below the "create", they'll be queue with it

    Yes, there must be a reason why this happen. I just hope this issue will be fix in the future. In my oppinion, this is not just a small issue.

    I also work with js framework like Phaser and CreateJS, I didn't experience similar issue with other framework I worked with.

    Technically I more prefer freezing frame/FPS instead of running all fuction syncroniously to avoid freeze.

    If there are a lag to execute a function, atleast I know why it's lagging.

  • it happens like that because it's how it was made to happen, it'S why there's a "on created" trigger you can use as a callback, it's not going to be fixed as far as i know

  • try working with it instead of against it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • it happens like that because it's how it was made to happen, it'S why there's a "on created" trigger you can use as a callback, it's not going to be fixed as far as i know

    Got it, i forget about "on created" trigger.

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