runtime.registerCollision ?

For developers using the Construct 2 Javascript SDK

Post » Fri Jun 22, 2012 2:12 pm

@Ashley

In my quest to learn about how behaviors and plugins work I came accross this.runtime.registerCollision. Can anybody tell me why and when do you need to use this.rfisher2012-06-22 14:12:41
B
17
S
9
G
7
Posts: 249
Reputation: 6,922

Post » Fri Jun 22, 2012 2:27 pm

If two objects overlap and a behavior like Platform or 8 Direction separates them, the 'Is overlapping' and 'On collision' events will never see them touching, and never run. So the player with 8 Direction could run in to a solid and 'On collision' would never trigger. Behaviors can use 'registerCollision' to say that two instances really collided but the behavior separated them. Then, later when it gets to 'Is overlapping' or 'On collision', it counts it as overlapping, so the event runs. End result - player runs in to a solid and 'On collision' still runs.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Jun 22, 2012 2:41 pm

Thank You.
B
17
S
9
G
7
Posts: 249
Reputation: 6,922


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest