How do I deal with overlapping objects and events

0 favourites
  • 5 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • Hi all

    I'm sure this has been encountered before, so I must be using the wrong keywords. Apologies for this.

    I have two objects which overlap. They both have separate events which trigger upon tap/click associated with them. When they overlap I want a tap/click to trigger from only the topmost object, but both events are being triggered.

    Can I temporarily neutralise the object underneath without having an "if topmost object is on screen/overlapping" condition?

    Hope that makes sense...thanks

  • What's wrong with having that condition?

  • Actually, you're right, Unnatural20. On reflection, I guess I have answered my own question here.

  • monsieurcobaye :

    You might be able to avoid overlapping e. g. if its two approximately round objects, by using distance, if its two boxes, by the coordinates combined with the sizes. Unnatural20 If you want to spare collision checking that is, which might be very much a reason to avoid that condition.

    So obviously, if you already check once for overlapping/collision, put it in there. If you can avoid that for performance, you should. Also note, that every time you repeat "if overlapping" or "on collision" the system actually tests each and every time. It is best to test every possible collision you need just once.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • MultipleChoice - thanks for that. As it happens, my layout is fairly simple and the condition shouldn't cause a performance issue.

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