How do I collisions on parented pinned objects

0 favourites
  • 7 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi folks, I have a bit of a problem that I cant seem to find a solution to online.

    I have layered pinned objects (two of objects) parented to a larger object. I have the parent collision disabled. I also have the middle layer (pinned 1) collision disabled.

    The logic i'm trying to solve is (i've uploaded an example graphic): when bullet hits object pinned 2 (bullet path 1), I want the collision on pinned 1 to activate but keep main parent collision disabled. When second bullet (path 2) hits object pinned 1 - then I want main parent to have collisions activated.


    I've tried assigning uid's to each instance, then swapping the stored uid values around but it keeps ignoring collisions after the first object (pinned 2) is destroyed. I think i may have messed up the logic or lost track of what values are getting stored to where :S



    One of the things containers allow you to do is to pick all items in the same container. When thing 2 gets picked by the collision, the associated thing1 and bluething get picked also, so you can activate collisions on thing1, and only the thing1 associated with the thing2 that got hit will activate.

  • Had a read through of that. If I understand it right, if one of the objects in the container gets created, the other objects get created automatically? Is there a way to create containers dynamically? The scenario i have is that one object gets layered over the other over time so i cant have them all created right at the beginning.

  • Containers are indeed creating all instances of the object types listed as "contained" from the moment one instance of the list is created.

    What container really help with is knowing that all the instances are "tied" together and it helps with the picking. You can't create container "list" at runtime.

    If I understand correctly what you are trying to achieve, you want your "Main" object to be protected by two "Barriers" right ? And when one barrier is hit, you want the other barrier to be the only one left. Is that exactly what you are trying to achieve ?

    I'm not sure then why you want to play with disabling collisions when you can modify the logic to make it so that hit barriers simply disappear.

    See the attached capx (that is not using families, but still doing the thing I understood you wanted to have).

    If this is not what you are looking for, consider attaching your own capx of your project as it stands and explaining what you are looking to achieve exactly.

    Perhaps you are going the wrong way about the mechanic you believe you want in and there is another logic to apply to do what you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Im trying to achieve a double barrier yes, but the barrier itself is smaller than the main enemy (hence why i have to disable the main enemy's collision as the barrier doesnt cover the whole thing).

    Think of it like the barriers attract the bullets so the enemy doesnt get hurt. If you look at the graphic i uploaded on my first post, pinned object 2 is the top layer which has to go first in order to break down the next barrier. But since the next barrier (pinned object 1) is not bigger than the main enemy, its collision doesnt cover the enemy. So what im trying to do is:

    1 - when pinned object 2 (green) is destroyed, enable pinned object 1's (grey-green) collision.

    2 - If pinned object 2 is not present (in relation to the main it was parented to) and pinned object 1 is destroyed (again, a check must be run to see if its associated with the parent its pinned to), enable (parent - blue) main's collision.


    I've set the enemies, barriers 1 and barriers 2 to their own families so when i call for families to be created, they're randomized. The main's start off with no barrier, then as time progresses the barrier 1 is spawned, and then after more time has passed - barrier 2 is added on top of all. Again, the barriers are layered and dont completely cover the main.

    [edit: even though i've got them being spawned randomly, i have different condition->events on each individual object and all the families working correctly too - as in each object can only be destroyed a certain way) I'll download your example (thank you both by the way for the help its very much appreciated) - and check them out. You're probably right and there's probably a better logic for this and my brain is just to sizzled to see it right now. If it still doesnt make sense, i'll try and get out a capx (the project is quite heavily into production and its in caproj format).
  • The thing that makes little sense to me is why a BIG main object would have inner barriers to protect it. But never mind it is your game.

    All you would have to modify a bit the example I've provided it to modify the size of the object "Main" and the size of the spawned "Barrier" instances and I believe you would have the behavior you are looking to achieve. Adding a timer so that the spawning is "timed" and that's it.

    You can always make a single file/capx from any project by going into the main menu and using "Save as Single File".

  • Its all good, I just ended up re-doing the enemy sprites to make it work. Gameplay before Graphics and all.

    Thanks anyway for the help!

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