Foreach loop is NOT working in this test

Discussion and feedback on Construct 2

Post » Thu Jun 30, 2016 1:27 pm

Hello guys,
I´m doing some tests with phisics and sudenlly the "foreach" loop stopped to work when I moved it to "On start of Layout" event, please, see the image:
Image

The foreach marked in yellow should execute! It seems that No1 instances are not created but they are!

You can try it yourself with this capx:
https://dl.dropboxusercontent.com/u/16702799/Perguntas%20em%20Foruns/Teste.capx

obs: The "alert" are only for debugging and can be disabled.
Be nice with others and with yourself!
My musics: https://soundcloud.com/vinians
My C2 Forum:
http://nmbr.forumeiros.com/
My Site:
http://www.dicasebytes.com.br
B
22
S
5
G
6
Posts: 167
Reputation: 4,949

Post » Thu Jun 30, 2016 2:12 pm

C2 doesn't let you pick newly created objects until the next top level event. Make a second "On start of layout", and move your Foreach there. There is a rope example here: realistic-rope_t65930. Your distance-joint code wasn't working for me.
ImageImageImage
B
71
S
21
G
232
Posts: 3,696
Reputation: 129,868

Post » Thu Jun 30, 2016 2:40 pm

C2 doesn't let you pick newly created objects until the next top level event

This is sad.... They need to explain it on the manual!
Thank you I will try your suggestion
Be nice with others and with yourself!
My musics: https://soundcloud.com/vinians
My C2 Forum:
http://nmbr.forumeiros.com/
My Site:
http://www.dicasebytes.com.br
B
22
S
5
G
6
Posts: 167
Reputation: 4,949

Post » Thu Jun 30, 2016 5:28 pm

yeah.. there recently was a long discussion about it when I posted it as a bug: viewtopic.php?t=178366
Basically, newly created objects get added to a "new object list" and aren't merged into the "instance list" until next "top-level event".. However, a newly created object forces the SOL to consist of only that new object..
Anyways. rexrainbow created a plugin that allows you to easily pick all the objects: http://c2rexplugins.weebly.com/rex_ginstgroup.html
I agree that this stuff should be explained thoroughly in the manual if it isn't in it.
B
43
S
19
G
65
Posts: 1,105
Reputation: 37,949


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests