Picking family instances vs. container objects

Discussion and feedback on Construct 2

Post » Mon Oct 28, 2013 9:30 pm

What is the best way to pick items from a container if an event related to a family is triggered (with a family member being in a container)?
I tried to find the answer on the forum, but failed to do so

Family: Tank consisting of [ ELC_AMX_Base, Hetzer_Base ]
Family instance variable: selected

Family: Turret consisting of [ ELC_AMX_Turret, Hetzer_Turret ]

Container: ELC_AMX_Base, ELC_AMX_Turret
Container: Hetzer_Base, Hetzer_Turret

Now if I have a condition that triggers on family instances:
| Tank is selected | actions...
for example,
how can I then find the turret belonging to the actual tank being picked? For example this condition picks an ELC_AMX_Base, it seems that the ELC_AMX_Turret is not being picked with it (which I would expect since it is in the same container!)

The documentation indicates that 'if an object from a container is picked, all objects from the container are picked as well',
but that doesn't seem to be the case with families.

The only solution I found so far was to give each Tank an instance variable to point to the turretUID and then use that in a sub event:

| Tank is selected |
   | Turret Pick instance by UID Tank.turretUID | [ action A,B,C ]

Is that the recommended approach?

Posts: 2
Reputation: 204

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests