Change the parsing order of array "for each" loop

Get help using Construct 2

» Mon Jul 30, 2012 12:07 pm

Hello there,

Is there any possibility to change the parsing order of the array "for each XY" loop from vertical to horizontal.

Example:
right now it goes like this: y0x0 y1x0 y2x0 y3x0 y0x1 y1x1 y2x1 y3x1 etc.

but it would be very handy to have it like this: y0x0 y0x1 y0x2 y0x3 y1x1 y1x2 y1x3 etc.
B
41
S
11
G
4
Posts: 505
Reputation: 7,242

» Mon Jul 30, 2012 12:14 pm

The first coordinate is the X actually (X0Y0, X0Y1, X0Y2, [...] X2Y0, X2Y1, etc...). In math, the X always represents the first coordinate (abscissa).

If you're not satisfied with the way the "array: for each element" works, simply do your own loops with "System: For" loops.

Have a loop for the Y and the one for the X. Make sure to use correctly the expression "loopindex" with the correct name for your loop.
New to Construct ? Where to start

Please attach a capx to any help request or bug report !
Moderator
B
243
S
85
G
39
Posts: 6,936
Reputation: 56,906

» Mon Jul 30, 2012 12:30 pm

I know, but with "for each loop" it is much faster to do this kind of operations.
B
41
S
11
G
4
Posts: 505
Reputation: 7,242

» Mon Jul 30, 2012 12:38 pm

For each "ordered" should give you what you need.
Just use the y value. It will parse ascending, descending, based on that value, and the index, low to high for any of the same value.
Not 100% on that last part, but that's the usual order of operations, and the chances of exact same y are pretty low when using subpixel.
B
160
S
48
G
80
Posts: 7,237
Reputation: 61,502

» Mon Jul 30, 2012 1:11 pm

Interesting, but how you can use "for each ordered" in conjunction with Array XY?
B
41
S
11
G
4
Posts: 505
Reputation: 7,242

» Mon Jul 30, 2012 1:38 pm

You don't
But that might be interesting to have in an array @Ashley.
B
160
S
48
G
80
Posts: 7,237
Reputation: 61,502

» Mon Jul 30, 2012 1:59 pm

Just use the system 'For' condition - isn't it just one extra condition?
Scirra Founder
B
355
S
208
G
71
Posts: 22,830
Reputation: 176,686