Weird For/Loop Behavior with List Object

0 favourites
  • 3 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • I was doing some experimenting with creating a loading bar during a For/Loop and discovered some strange behavior with the List Object and I'm not sure if it's intended or not.

    Firstly, I discovered that during a For/Loop the entire game pauses and waits for that loop to finish before calling any more events or updating the image...

    EXCEPT for the List Object which can be updated during a For/Loop to show the current LoopIndex. I also noticed that using a List Object this way allows other things that normally would wait until after a For/Loop to finish (like animations, or rotating objects) will continue normally DURING the For/Loop.

    I made two C3P files to show what I'm talking about.

    This one contains a List Object: dropbox.com/s/pxo42r7helf0642/Loop%20Test.c3p

    This one doesn't: dropbox.com/s/zdxhbi84rrpn5np/Loop%20Test%202.c3p

    It also seems like updating the List Object takes a lot more time than most UI objects as the loop moves MUCH faster when it's not in the code.

    Interested to see if anyone has any thoughts on this.

  • Interesting find!

    I also noticed that using a List Object this way allows other things that normally would wait until after a For/Loop to finish (like animations, or rotating objects) will continue normally DURING the For/Loop.

    No, I don't think so. The loop ends pretty quickly in less than a second, and then the sprite animations and behaviors start playing. The updates for all form control objects (listbox, progress bar etc.) seem to be queued and happen after the loop has ended. All these objects skip the intermediate values and only show the final result, oddly except for the listbox, which tries to show all values. And it takes a long time for it to iterate through all values.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All these objects skip the intermediate values and only show the final result, oddly except for the listbox, which tries to show all values. And it takes a long time for it to iterate through all values.

    This does make more sense based on what I'm seeing. Thanks!

    That actually makes me really happy because that means the level-generation loop in my game is actually finishing WAY faster than it appears since I'm using a list object to report on its results.

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