Change the parsing order of array "for each" loop

Get help using Construct 2

Post » 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
42
S
11
G
4
Posts: 505
Reputation: 7,267

Post » 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

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » 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
42
S
11
G
4
Posts: 505
Reputation: 7,267

Post » 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.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Jul 30, 2012 1:11 pm

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

Post » Mon Jul 30, 2012 1:38 pm

You don't
But that might be interesting to have in an array @Ashley.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Jul 30, 2012 1:59 pm

Just use the system 'For' condition - isn't it just one extra condition?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31 and 29 guests