How do you set independent door triggers?

Get help using Construct 2

Post » Wed Aug 07, 2013 3:43 am

Hello.

I'm making a top down shooter that has doors that open and close using proximity triggers. To do this I've placed created a door and an invisible trigger and placed them in the same container. I've then placed the following event on the event sheet.

If DoorTrigger is overlapping player
OR
If DoorTrigger is overlapping Enemy

Open door. (I simplified this part as it's not the part that's giving me trouble.)

Else Close door.

This piece of code opens a door when the player of an enemy moves over the trigger and closes the door when the player or enemy moves out of the trigger area.

The problem is that if I move in to a trigger area and a door opens, the door won't close unless ALL trigger areas are clear of enemies. An enemy on the other side of the map who is travelling through a door can hold all doors open.

I really don't know how to work around this. Can anyone please help?
B
10
S
3
G
1
Posts: 30
Reputation: 1,279

Post » Wed Aug 07, 2013 4:16 am

Could you post an example capx? It would help us to help you.
B
12
S
3
G
3
Posts: 36
Reputation: 3,048

Post » Wed Aug 07, 2013 4:23 am

give the door the line of sight behavior and use a for each loop. using the line of sight will eliminate the need for a invisible detector sprite. just set the distance you want for the door.
B
25
S
7
G
1
Posts: 83
Reputation: 2,550

Post » Wed Aug 07, 2013 7:31 am

As BACLog mentioned, the for each loop will fix your problem with the triggers
B
9
S
2
G
2
Posts: 59
Reputation: 1,024

Post » Wed Aug 07, 2013 1:54 pm

Wow, that was so much easier than I thought it would be. Thank you guys so much for your help. It's greatly appreciated. (And I never would have thought of that by myself!!)
B
10
S
3
G
1
Posts: 30
Reputation: 1,279


Return to How do I....?

Who is online

Users browsing this forum: Ashley, brunopalermo, jorgmaquoi and 7 guests