On Collision v IsOverlapping

Just started using Construct 2? Post your questions here

Post » Sat Mar 07, 2015 12:56 pm

I'm trying to think of practical examples of when one of these is correct over the other.

If this is being used for a physics-type behaviour, and my objects objects are solid then IsOverlapping should never be true.

If I am mimicking a coin collecting scenario (e.g. Super Mario Bros.), then they should be the same, but if the engine is slow and misses the OnCollision event then I guess it would be possible to be overlapping.

So...

Is it fair to say, always use OnOverlapping, as this will not suffer from the case of an OnCollision getting missed?

If not, could anyone suggest practical examples of when one would be correct and the other incorrect?

NB: I'm assuming that it is possible for an OnCollision to be missed due the underlying engine's timings. I could be wrong.

Thanks All.

Dave
B
5
Posts: 10
Reputation: 250

Post » Sat Mar 07, 2015 5:00 pm

on collision is detected whenever it happens, not just when objects collide with their edges.. for example you have an object. then create another one on top.. on collision will trigger. but it won't in the case that they were already overlapping, for example... two objects are overlapping.. and your event goes.. A on collision with B, if A.variable is 1... /// if your A object was overlapping B, no matter when you change the variable, the collision won't trigger since they were overlapping before that
Image
B
50
S
12
G
6
Posts: 270
Reputation: 11,746

Post » Sat Mar 07, 2015 5:02 pm

and plus, even if your objects are solids the might overlap, specially if they are moving fast. if they bounce you may not notice, but if they are suposed to stop on collision, you will see sometimes the overlap some pixels, or there is a small gap between the objects
Image
B
50
S
12
G
6
Posts: 270
Reputation: 11,746


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests