implied For Each loop ?

Get help using Construct 2

Post » Thu Aug 23, 2012 7:25 pm

I several Items on the stage.

If I say, on event sheet, ...
Item -> some condition -> some action
...it works as expected for all the Items.

If I say...
System -> For Each Item -> (subevent) Item -> some condition -> some action
...it also works as expected for all the Items.


So in the first example, is it looping through an index of all Items on the stage? iow. an implied for each loop?

Is there any advantage ( performance, etc ) to explicitly using a For Each loop ?
sam3d2012-08-23 19:26:17
B
7
S
1
Posts: 11
Reputation: 929

Post » Thu Aug 23, 2012 7:50 pm

See How Events Work in the manual. All object conditions (i.e. not system conditions) have implied for-each loops. The implied for-each is faster, so avoid using the 'For Each' system condition where not necessary, since it will degrade performance.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Aug 23, 2012 8:03 pm

Thanks Ashley.
B
7
S
1
Posts: 11
Reputation: 929


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests