How do I disable collisions with only one copy of instances?

Get help using Construct 2

Post » Tue Nov 11, 2014 1:20 pm

I have immovable physical doors on level. All doors are copies of one instance. When door opens, I disable collisions with player, but collisions disabling for all doors, even which are closed. How can I disable collisions with one copy of instance?
B
5
Posts: 6
Reputation: 252

Post » Tue Nov 11, 2014 1:38 pm

Just use an instance variable like "is_ignoring_collisions" and don't do anything if it's set to true.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Tue Nov 11, 2014 2:09 pm

What means "don't do anything"? How can I ignore collisions in Physics behavior? I disable collisions for doors with true instance variable in For Each loop, but player doesn't collide with other doors.
B
5
Posts: 6
Reputation: 252

Post » Tue Nov 11, 2014 5:23 pm

You need to describe your project more or attach an example.

How did you set it up? A player sprite with 'platform behavior' and door sprites with ' solid behavior'? You could also create an open door sprite and destroy the closed door at the same position on your "open door action". Open door sprites shouldn't have the solid behavior then.

I would prefer doing it like Ashley said with instance variables, but don't know if that fits to your project.
B
34
S
9
G
3
Posts: 206
Reputation: 7,851

Post » Tue Nov 11, 2014 5:37 pm

You can't partially disable the "solid" behavior (i.e. have it act as a solid for select few other objects), however, you can specifically disable said behavior for only one instance. What does your event that disable collision look like ?
B
69
S
28
G
24
Posts: 977
Reputation: 18,739

Post » Wed Nov 12, 2014 6:28 am

I use Physics behavior on doors and player. Solved it myself: I compare the nearest door animation and if it is open I disable collisions for all doors, else enable it. But I think there is better way..
B
5
Posts: 6
Reputation: 252


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 19 guests