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
45
S
11
G
4
Posts: 517
Reputation: 7,398

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
296
S
119
G
96
Posts: 7,328
Reputation: 71,298

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
45
S
11
G
4
Posts: 517
Reputation: 7,398

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 ImageImage
B
172
S
50
G
183
Posts: 8,439
Reputation: 115,597

Post » Mon Jul 30, 2012 1:11 pm

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

Post » Mon Jul 30, 2012 1:38 pm

You don't
But that might be interesting to have in an array @Ashley.
Image ImageImage
B
172
S
50
G
183
Posts: 8,439
Reputation: 115,597

Post » Mon Jul 30, 2012 1:59 pm

Just use the system 'For' condition - isn't it just one extra condition?
Scirra Founder
B
402
S
238
G
89
Posts: 24,632
Reputation: 196,031


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests