How do I do for loops (not for each)

Is there a way to have for loops in gdevelop? I don’t want for each object, just a regular for loop where I can use the value of the loop index. Hopefully have nested for loops.

I don’t see a way to use the loop index using repeat.

Hi Lohborn,

Maybe you can try in event sheet (on top right) the + button:

You can then select Repeat and specify a value.

Hope it help

You can use expressions with the Repeat although autocomplete doesn’t seem to popup for me. You need to know the expression or copy/paste it from another line. You can also use WHILE. It’s under the same large plus.

Either way, if you need a variable, assign the initial value before the Repeat or While and then change it within the loop. You can put your events either on the same line or as sub-events.

Loops and Nesting are great for initialization but too many loops especial large will add pauses while they run.