How do I deal with overlapping objects and events

Get help using Construct 2

Post » Thu Jan 22, 2015 11:54 am

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
B
3
Posts: 7
Reputation: 189

Post » Thu Jan 22, 2015 4:18 pm

What's wrong with having that condition?
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Fri Jan 23, 2015 11:40 am

Actually, you're right, Unnatural20. On reflection, I guess I have answered my own question here. :oops:
B
3
Posts: 7
Reputation: 189

Post » Fri Jan 23, 2015 2:10 pm

> @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.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Thu Feb 26, 2015 2:32 pm

@MultipleChoice - thanks for that. As it happens, my layout is fairly simple and the condition shouldn't cause a performance issue.
B
3
Posts: 7
Reputation: 189


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 56 guests