Can't iterate through sprites right after they are created? Promise issue?

0 favourites
  • 4 posts
From the Asset Store
Awesome drifts on auto generate way,tap to steer right.
  • So, I am creating 3 sprites in a function and setting them to Invisible. I then call another function that iterates the Sprite(s) and sets them all to Visible. The sprites do not appear.

    Maybe since the sprite creation and visibility settings are happening in a function, that the ShowSprites function is being called/finishing before the CreateSprite functions are finished?

    Putting the System Wait for 0.001 between the sprite creation and the ShowSprites function makes it work. But I'm wondering if there's a deeper problem.

    Pic attached so you can set up a similar experiment.

  • It's how construct works, creating an object schedules for it to be created on the next tick, so you have to put your events with "create object" so they can be scheduled alongside it.

    using the wait action forces to wait until the next tick.

    Try to use triggers instead, like "on created", or you can also use the "pick last created" condition

  • Makes sense. And thanks for pointing that out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmmm...neither of those triggers are working for me. Maybe the best solution is to just do a System Wait or does something else then make the sprites visible.

    EIDT: Wait For Previous Actions will do the trick.

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