Question about the "Repeat" event

0 favourites
  • 4 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Does Construct check at the start of the event (before the first loop is ran) and simply loops the action X amount of times, or does Construct check at the end of each loop to see if the number of loops is has performed is >= X?

    My issue is that I'm working on a random level generator, and because I'm not brilliant enough to write an a perfect algorithm I simply want Construct to check if the last placement of structures is legal, and if not to delete the last structure placed and to add another structure to be placed (by increasing the loop count) to offset it. As you can guess this is only possible if Construct's Repeat event in the latter manner.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you mean using a variable for the repeat count? It will evaluate the repeat count expression once then run that many repeats, which I think is the first way you describe. You could try using a 'while' loop instead if you need variable behavior.

  • Does Construct check at the start of the event (before the first loop is ran) and simply loops the action X amount of times, or does Construct check at the end of each loop to see if the number of loops is has performed is >= X?

    Nope, C2 reads the event sheet top to bottom and executes the loops when it's "their turn" in the logical order you wrote.

    When the "repeat" condition is encountered, the execution will "loop on the event" for the number of times input as parameter. (so the condition is looped as long as LoopIndex is not equal to the parameter)

  • Ah, curses! thanks for the quick response

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