Action Between Same Object Different InstanceValue

0 favourites
  • 3 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hello guys, I want to ask question regarding action that involve same object but different in instance value.

    For example: I make one ball which have instance value "color". When the instance value is set to "red", the color become red. "Blue" become blue.

    The question is I want the red ball to destroy the blue ball when colliding.

    Is that possible?


    <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Create 2 variables in the object.

    Name one "colour" and set each instances value in the editor to "red" or "blue".

    Name the other variable "overlapping_instance_ID".

    add the event

    object ball overlapping ball

    set action

    set "overlapping_instance_ID" to unique ball ID.

    Create a subevent, and set the condition to

    pick instance by unique id, and set the value to the variable "overlapping_instance_ID".

    Now add another condition to the event, ball variable "colour" = "red", set action to destroy ball.

    Alternatively you can use another object as a detector, do a for each loop on all balls named blue and set the detector to their position, then do another event and if detector overlapping ball and ball colour is red then destroy ball.

  • Ethan Big thanks to you mate! <img src="smileys/smiley4.gif" border="0" align="middle">

    I applied your logic and here are the results:

    First logic

    <img src="" border="0">


    Result: When red object overlap with another red object, both destroy. I don't know, maybe I got it wrong somewhere.

    Second logic

    <img src="" border="0">


    Result: Work accordingly, although when I use For Each (Once), the collision object created every tick, I wonder if it is a bug. I want to test it with newer C2 version, but download keep failed.

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