Families not being PICKED

Discussion and feedback on Construct 2

Post » Fri Oct 19, 2012 9:33 pm

I have a layout with 6 blue boxes.

As soon as layout starts, I iterate through all 6 blue boxes, destroy them and spawn red boxes in their place.

All is fine until now.

I then want to iterate through all 6 red boxes and make the first 4 with 50% opacity and the other 2 with 0% opacity. Here is where it is failing.

I am using Families.
What is happening is that the second FOR EACH loop is still referencing the blue boxes and setting them 50% and 0% opacity even if they were destroyed.

What am I doing wrong?
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Fri Oct 19, 2012 9:34 pm

Here is a capx to show the above in action:

http://dl.dropbox.com/u/54046169/test.capxbjadams2012-10-19 21:34:25
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Fri Oct 19, 2012 10:10 pm

You can't pick the newly created objects until the next top level event. link.

picking.capx (r107)
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Fri Oct 19, 2012 10:17 pm

Thanks a lot for the clarification.

I have a lot of these conditions embedded in my project, so it's going to take a good restructuring to try to work around it, but at least i now know the WHY
B
41
S
11
G
4
Posts: 428
Reputation: 7,356

Post » Fri Oct 19, 2012 10:25 pm

Putting the opacity change stuff into a System->OnLoadingFinished makes it work.

Not quite sure why - but it feels like it's picking all the families first before the red ones have been created. Perhaps when you create a sprite it puts it in a list and creates at the end of the frame.

@Ashley may be able to shed some light on it.
B
11
S
4
G
3
Posts: 70
Reputation: 3,071

Post » Fri Oct 19, 2012 10:25 pm

Dammit - ramones got there first.
B
11
S
4
G
3
Posts: 70
Reputation: 3,071

Post » Sat Oct 20, 2012 8:06 am

yes it's just the way that construct2 works

will have to work around it as i need to change the colors to red in the middle of the code not just at startup!
B
41
S
11
G
4
Posts: 428
Reputation: 7,356


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests