Checking for one of several collisions with just one event?

  • I suspect this question betrays a fundamental lack of understanding of the way Construct programs run, but I'm still working on wrapping my mind around their structure.

    One of our students is trying to build a game that includes several characters made up of multiple sprites held together by the pin behavior. He wants to be able to have individual parts of the characters fall off if struck (picture a hand made up of multiple fingers, and if a flying object collides with a finger, that finger is destroyed). Is it possible to do that without writing a separate "on collision with flying object" event for each finger? That is, is there a way to say something to the effect of "flying object -> on collision with any sprite --> that sprite -> destroy"?

    We've explored trying to create an array of UIDs of the constituent objects, but we haven't made much progress.

    Thanks in advance!

    Humboldt High School

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah , you need to check out how picking works.

    Objects are picked by conditions, and then you do stuff to them in the actions.

    object A on collision with object B picks only the objects, or instances picked by the condition.

    No need to make special events to pick what's already picked.

  • Hi HumboldtSPPS,

    If you use multiple sprites you need to put them into a family and use it in an collision event: on collision with family_finger -> destroy family_finger. Costruct destroys only the family member that was on collision. Another way without using families is to use only one sprite with different animations for each finger.

  • Thank you so much, kriand! This is exactly what I was looking for and having trouble finding. We had been reading documentation about different plugins and containers, but I hadn't looked at the rest of the primitives. Much appreciated!

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