Check for Loop End?

Get help using Construct 2

Post » Sun May 26, 2013 6:59 pm

Hi,

I wonder how to perform an event at the end (last loopindex) of a for-loop?

Any help welcome :)
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun May 26, 2013 7:11 pm

for( 0.. endIndexHere)
.. loopystuff
.. if(loopIndex = endIndexHere)
... stuff for the final value

When creating a for loop you enter the end index, so you know the final loopIndex. Just check when it appears and do your thing. :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sun May 26, 2013 7:16 pm

Thanks, but how to access the "if" in c2? I can compare global variables for a condition, but I can see the loopindex only at an action.

Could you show me an example?
B
15
S
3
G
5
Posts: 396
Reputation: 4,977

Post » Sun May 26, 2013 7:21 pm

[QUOTE=xeed] Thanks, but how to access the "if" in c2? I can compare global variables for a condition, but I can see the loopindex only at an action.

Could you show me an example?[/QUOTE]

Add condition 'system'->'Compare two values', you can enter two whatever values you desire :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sun May 26, 2013 7:24 pm

of course, thats it.

Many thanks :)
B
15
S
3
G
5
Posts: 396
Reputation: 4,977


Return to How do I....?

Who is online

Users browsing this forum: djcrazypants, marekmk and 5 guests