How do I stop a loop from repeating?

  • Hi all. I'm not sure if it's some setting I've tripped or something (seems unlikely) but it seems my loops now repeat forever. Perhaps I'm misremembering, but when I had a "For X to Y" loop as the sole condition of an event, it would simply run one loop spanning X to Y. Now it seems like the loop repeats itself infinitely unless I add another condition which explicitly prevents it from running. Was this always the case?

  • Without seeing the setup of your events it's impossible to say what the issue is..

  • Per the Manual:

    Loops

    Loops can be stopped with the Stop Loop system action.

  • It's a basic For loop, as in "For "xyz" from 1 to 100". There are no other conditions together with it and no other events which call for this loop or anything as it was meant to run at the beginning and never again. IIRC it used to do just that, but after running it a few times it turns out the loop begins running again after it finishes, so I've had to add a basic flag that gets set off and prevents it from running again. It's not a big deal, I was just wondering if I've inadvertently messed with some setting or something because I could've sworn it didn't used to do that. Perhaps I'm confusing C2 with CC.

    Anyway, thanks for the replies.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • add trigger once condition, or set your loop as a sub event, for example :

    on start of layout ->

    (add sub event) for()

    on function("loop")

    (add sub event)

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