How do I use for each x element

Get help using Construct 2

Post » Wed Nov 26, 2014 9:16 pm

You've been a great help so far with my efforts so I hoped someone could answer my next question:

When running through an array with For Each X Element, does loop index not work?

Cheers
B
7
Posts: 33
Reputation: 341

Post » Wed Nov 26, 2014 9:25 pm

If you've tried it and it doesn't then I guess it doesn't :) Would it be meaningful if you had say, a 3D array?

edit: sorry you've specifically said for X elements. I guess that could make sense. But a quick test shows it doesn't work. I normally use normal for loops and Array.at() anyway. Maybe it's the old school developer in me :) It's just more flexible IMO
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Nov 26, 2014 9:43 pm

Yeah, I can't get it to work.
As I understand it there's also a slightly hidden command: loopindex("name of loop") but that doesn't work either.
I tried: loopindex("x")

:-(
B
7
Posts: 33
Reputation: 341

Post » Wed Nov 26, 2014 9:49 pm

You'll have to use the built in expression "CurX" if using the built in "For Each X Element"
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Wed Nov 26, 2014 10:32 pm

codah wrote: I normally use normal for loops and Array.at() anyway. Maybe it's the old school developer in me :) It's just more flexible IMO
Not only is it more flexible, it is the only way to iterate through an array and keep the "stop loop" functionnality ! I never liked Array's built-in loops...
B
74
S
31
G
26
Posts: 994
Reputation: 20,198


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests