Collision Check understanding.

Get help using Construct 2

Post » Mon Oct 29, 2012 3:55 pm


If I set something like this:

-------------------------------------------

On "X sprite" collision with "Y sprite == "X sprite" destroy
                                          add 100 to score

-------------------------------------------

Is this collision check occurring on "every tick"?

Because I have a lot of this collision checks, and I was reading on "Performance tips" that this could be a slow down reason, and it recommends to check collisions every second, or every half second, instead of every tick.
B
11
S
1
G
2
Posts: 57
Reputation: 1,690

Post » Mon Oct 29, 2012 6:08 pm

Yes, it is..
I can't really tell you any performance tips that won't be in the manual.. It'd be nice to know exactly how the collision checks actually work.

If you happen to be checking between 2 circular objects, you can simply compare distances instead though.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Tue Oct 30, 2012 12:53 am

Collision checks are two tiered - first there's a simple bounding box check, then if there's an overlap, it does a second check using the collision polygons of those picked instances.

You can reduce the collision checks by setting conditions to filter out some of them beforehand. Such as:

Sprite.variable=1
Sprite overlaps sprite2
- rotate sprite

Then only the sprite instances with variable=1 are checked, saving performance.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397


Return to How do I....?

Who is online

Users browsing this forum: badmoodtaylor and 8 guests