0 Favourites

Picking family instances vs. container objects

  • 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

    Example:

    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?

    Thanks,

    Jochen

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)