Better to use collision or overlap?

Get help using Construct 2

Post » Thu Mar 01, 2012 6:29 am

Is there much difference between the collision and overlap conditions? Just wondering in case 1 of them is more efficient or something. Is the collision trigger checked every tick? Whereas with an overlap condition, I have more control as I can use it as a 3rd condition or a subevent, so the overlap is only checked when I need it to be. But if collision is a very efficient/simple/non-intensive condition then it doesn't matter which one I use?
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Thu Mar 01, 2012 11:58 am

The main difference are that collision is a trigger and overlap isn't.

Thus collision is an instant condition, it's true the first tick where the object start overlapping, and then false.

But! It's a trigger. So it's not exactly the same as doing
[code]Object: is overlapping
System: trigger once[/code]
The main difference as far as I know is that triggers aren't checked in the main event loop order. But (not sure) checked before even running the entire game loop, for better speed.
So you have to be aware that orders between triggered and non trigger events might not be respected. (but order inside a triggered block or between triggers of the same nature are respected)Yann2012-03-01 12:00:33
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Mar 01, 2012 6:23 pm

Actually, in the SDK, 'On collision' is a "fake trigger", meaning it's treated in the editor like a trigger but coded like an ordinary condition!

'On collision' is therefore treated almost exactly like:

+ Is overlapping
+ Trigger once

'Is overlapping' actually does looping over the affected instances which is not usually noticable, but that behavior should be removed from a future build anyway since it is inconvenient in some situations.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests