How do you set independent door triggers?

0 favourites
  • 5 posts
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • 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


    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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Could you post an example capx? It would help us to help you.

  • 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.

  • As BACLog mentioned, the for each loop will fix your problem with the triggers

  • 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!!)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)