Trouble with objects vs instances?

0 favourites
  • 5 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I've set up some events that work perfectly if there is only one instance of an object. But once I add a second instance, it just doesn't work. I'm sure it's just my ignorance, but I don't understand how to differentiate instances when making events.

    Example, I set up object A to be destroyed when object B has a collision with object C. Works perfectly. But when I add another instance of objects A and C, I've had either all of the instances of that object get destroyed or sometimes neither instance gets destroyed. How do I differentiate which instances are affected? I assumed UID but I don't see how to choose that under events.

    Also, is there a way to group two object instances together? Say I have an object but want a second collision box for it (so that another event is triggered separate from the second collision box). I make an invisible collision box and place it. It works. But if I copy both instances, the second set of objects don't behave like I expect.

    Thanks so much for all of your help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It takes a while to get used to picking instances in Construct. When you say destroy object A, it's not related to the B and C that are overlapping. I can't see the game so I don't know how they should be related but if it's a switch of some kind you can use instance variables on the instances and pick that way to match them.

  • That was my question. When creating events, how do you differentiate between instances? I'm sure I'm missing something small but I'm stuck. Thanks for your reply.

  • You limit the number of picked instances with conditions on the left and apply actions to those picked on the right. If you don't pick anything with a condition on the left then it applies the action to all instances. If you used something like on object touched, do an action then it picks the one you touched. If you said where object.var=3, do an action then it does the action to all instances where var=3.

    But that isn't really your issue here, you need to relate A to the B and C that are overlapping and the only way I can think of based on info given is to have instance variable identifier where related A,B and C have the same number and when you pick which B overlaps C, you pick the A which has the same variable number attached.

    If that doesn't help then please share some more information about your game, maybe there is a better way to get the logic you want.

  • Thanks again. I found a workaround that was pretty simple. I instead used one of the objects, different but consistent in every case to be the condition. There's surely a more elegant way than what I did, but it's a solution. I appreciate the info though.

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