Multiple colliders for on sprite

Get help using Construct 2

Post » Wed Jun 27, 2012 7:05 pm

I'm wondering what the easisest way of adding more colliders to the same sprite is. Because I need the sprite to have a bigger collider when colliding with a specific type of object.

I guess I need to create an other sprite and pin it to my object? I've tried that but when I attached it to my main sprite the main sprite stopped acting like an instance and all sprites with pinned collider sprides acted the same.

I would really appreciate an example of how to do this while preserving all sprites as instances :)
B
8
S
3
G
2
Posts: 45
Reputation: 2,186

Post » Wed Jun 27, 2012 7:06 pm

What do you mean by "stopped acting like an instance"?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jun 27, 2012 7:11 pm

The "main objects" where moving around randomly. And when the collider that is pinned to the objects collides with an other object the "main object" which the collider is attached to is supposed to change direction.

But when I tried this all "main objects" changed direction.

I can maybe create a simple project showing my problem and upload it.
B
8
S
3
G
2
Posts: 45
Reputation: 2,186

Post » Wed Jun 27, 2012 7:31 pm

Ah, I see what you mean now. Your problem here is that when the "Collision" objects collide with each other, the "Collision" objects are the ones being picked.

You want to pick the "Main" object and apply events only to that.

In order to solve your problem you'll need to track which "Collision" object is connected to which "Main" object.

One way would be an instance variable to store the collision UID:

PickingCollision.capxNimtrix2012-06-27 20:03:49
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jun 27, 2012 8:02 pm

Thank you very much!
That's exactly what I was looking for! :)
B
8
S
3
G
2
Posts: 45
Reputation: 2,186


Return to How do I....?

Who is online

Users browsing this forum: selaus and 0 guests