Register multiple collisions with cloned objects

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi all, I'm having a problem that's probably pretty simple to solve, but I can't seem to wrap my head around it with IID/UID usage. Basically, the numbered boxes have three animations. When the IV on the box is a certain number, it changes to a corresponding animation. The issue arises when I attempt to do multiple checks with cloned objects. I haven't the foggiest idea how to differentiate the boxes or make the check repeat after the first time. I've tried a handful of things, but nothing seems to be working.

    My goal here is that when the red boxes are overlapping the numbered rectangles each rectangle reacts independently from the others.

    I'm in a real bind with this, though I feel like I'm really only a stone's throw away from the answer. Any help would be much appreciated.

    CAPX: dropbox.com/s/lptymb0ds5827ip/IndividualCollisionhelp.capx

  • If I'm understanding what you are trying to do, your code is correct except for one line:

    On line 25 where you are picking the closest sprite based on the convicts image point, comment that line out. Your code should work now.

    There are two issues here:

    1) If you use a object family to in a condition, ALL further actions must also be on the family. You can't use "Convicts Family" and then call an action on "Convict" - As far as the scope is concerned they are two separate objects. You need to replace your "Pick Nearest" with the convict family.

    2) The "Is Overlapping" statement should already be picking the correct box underneath it - further picking the closest object does nothing.

    Edit - I think maybe the confusion here is that when you pick a family it automatically selects the correct object for the given condition. You don't need to select a specific object type from that family. If you have a family of shapes (square, triangle and circle) and you say "Where Shapes are overlapping player" and the triangle is over the player, C2 will select the triangle.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • While I understand what you're saying, the fix you suggested unfortunately doesn't help. I think I may have explained inadequately.

    The intention is that when a member of the Family "Convicts" overlaps "Sprite", that specific "Sprite" plays the animation (animation is named "FIlled") wherein it displays the number 2. Upon pressing the G key, all instances of "Sprite" playing the animation "FIlled" should have their IV increased and be set to play the animation "Locked".

    The problem I'm experiencing is that I can only get one of two things to happen;

    1) A single "PHConvict" overlaps a single instance of "Sprite" and both of them are set to play the animation "FIlled".

    2) A "PHConvict" is placed on both instances of "Sprite", one is correctly set to display the animation "FIlled" (looks like the number 2), whereas the other one remains on the initial animation (looks like the number 1). When G is pressed, the one displaying 2 correctly switches to the animation "Locked" (displays the number 3), however the second one is left behind.

    The intent is that each instance of "Sprite" responds correctly to being overlapped by a member of the "Convict" Family. The intent for the final product is that the player should be able to press G to simultaneously change the animation of each "Sprite" currently playing the animation "FIlled" (displaying the number 2) to "Locked" (displaying the number 3).

    I hope this helps, sorry for not fully explaining properly, but thank you for your prompt response.

  • Is this more what you mean?

    Capx Download

    Note that I added a drag/drop behaviour to the convict object just to make testing easier. You might want to remove that later.

  • Thank you so much, you completely solved it. There was a bit you put in that reset the counter when the Convict left the specified area, which is great, and I appreciate the extra effort, but I deleted that bit because the counter is not intended to reset once it's reached 3. Totally an omission on my part, but thanks for putting in the work!

    I really, really appreciate your help. Thank you very much.

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