Containers and Families

0 favourites
  • 2 posts
  • Containers and Families don't mix reference associated instances.

    Lets say you have 2 objects and 2 families

    If hitbox overlaps Attack

    destroy movebox

    This works as intended with Containers and instancing.

    if hitbox.family overlaps attack

    destroy hitbox.family

    This works as intended, destroying only that one instance.

    if hitbox.family overlaps attack

    destroy movebox.family

    This destroys every movebox.family instance. It should hopefully recognize the associated instances of the family objects.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Thndr, <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    You might be able to solve this by using "Families" to escape the reciprocal picking that happens with containers.

    Manual > Families: https://www.scirra.com/manual/142/families

    Setup:

    Place the person into a family named "Damageable".

    Event:

    Hitbox is attacking. // Selects all attacking Hitbox objects.

    For each hitbox.

    Event:

    Hitbox is overlapping Damageable family

    Pseron.UID does NOT equal Damageable.UID // Prevents the Hitbox from attacking the Person who owns it.

    Actions:

    Damage Damageable. // Deals damage to all Persons overlapping the Hitbox who are not the Hitbox owner.

    Note the sub event condition that includes Person.UID.

    Here we are assuming that the Hitbox's Person is selected because they are both in the same container, and we're also hoping that won't influence the selected objects in the Damageable family, and it shouldn't, BUT...

    If you want to be absolutely sure that the containers aren't involved, and thus can't get up to any of their containerly shenanigans, then instead of getting Person.UID from the Person implicitly selected along with the Hitbox, you can store the Person UID directly in the corresponding Hitbox when the Hitbox is created.

    Event:

    Hitbox, On created:

    Actions:

    Set Hitbox private variable "parentPersonUID" to Person.UID.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)