I use this construction a lot:
Repeat VariableChildCount(someArray) times:
and getting a working index into the array is unnecessary complex:
as you cannot add a variable on the Repeat event itself so you need to put the Repeat event UNDER the index (i) declaration.
I would suggest that the Repeat statement is enhanced to
Repeat x times, store the index in <variable>:
a bit similar to the For each child variable (which stores the child)
Bouh
February 17, 2026, 12:51pm
2
This is a finalized feature; it will be in a release within 1-2 weeks.
4ian:master ā 4ian:cursor/loop-events-local-and-index-f89f
opened 12:04PM - 14 Feb 26 UTC
- [x] Add support for local variables to all these events
- [x] Add support for⦠local variables for all variables of "For Each Child Variable"
- [x] Add support for adding a "loop counter" variable. This is actually a local variable.
<img width="549" height="467" alt="image" src="https://github.com/user-attachments/assets/e149f9cc-0c11-4848-9566-33875b863dea" />
<img width="1012" height="221" alt="image" src="https://github.com/user-attachments/assets/9bea57bf-da49-412e-b799-3e97757535ee" />
Some examples:
<img width="1123" height="866" alt="image" src="https://github.com/user-attachments/assets/8b1a1498-24a5-42ef-87f8-aa817ad82a50" />
<img width="1121" height="882" alt="image" src="https://github.com/user-attachments/assets/8ef13c04-6e94-43d9-bf01-397f0a5d74a5" />
<img width="1111" height="943" alt="image" src="https://github.com/user-attachments/assets/0b9b5732-ab50-42da-98ba-fcaf65e32be3" />
5 Likes
Are we getting closer to the classic for⦠Next? That would be nice.
For variable start at 0 end at 10 step 2
For variable start at 10 end at 0 step -2
For variable start at 0 end at 10 step .5
I donāt think thereās an equivalent to that in Javascript, so I donāt think youād see that in events, but anything is possible?
1 Like
Itās not as clean as the basic For⦠Next but close.
Bouh
February 18, 2026, 9:30am
6
Silver-Streak mainly said that a custom step is not common, even in code.
Basically, in GDevelop, the step will be the classic i++.
If you want a custom step, you will have to use the index and do the calculation yourself inside the loop.
2 Likes