How do I operate multiple doors on the same layout?

0 favourites
  • 8 posts
From the Asset Store
The package contains 105 sounds This sound library is perfect for voicing mechanical doors in your Sci-Fi game.
  • Hi all,

    I want to have multiple doors, to multiple rooms on my top-down layout (think internal doors to a house).

    I'd like the player to walk up close to the door, then click 'E' to open, and 'E' again to close.

    I can manage it with one door using:

    distance (Player_base.X, Player_base.Y,Door.X, door.Y)

    and setting it to less or equal 50

    Then adding 'System > Keyboard 'E' is down' command.

    My troubles start with using families and getting a function to control each UID individually.

    Anyone have any tips?

    Thanks in advance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use a string variable on the door object that is the name of the room to go to. When you pick the door and press E you can go to door.variable.

  • Thanks for the reply... i'm not sure I understand however.

    All the doors are the same and simply need an open/close function.

    I was hoping to keep the code as clean as possible so I could use multiple instances like in the image below:

  • Can you pick nearest to sprite xy based on whatever criteria you set?

  • Ok based on the picture I don't see the need for picking by UID or families as you can just pick the nearest door, as you were doing with distance. Where is the problem?

  • The problem quite simply is that when I duplicate the doors, every time I open one they all open lol

    I need to learn how to have duplicate objects acting individually without actually making unique doors every time.

    That's where I thought families (for grouped open/close actions) and UID (to only open one at a time) might come into it?

    Thanks

  • It's because you're using a system condition and system does not pick the instance you want. You need to use object conditions such as mentioned above 'door pick nearest to player' or if the player is overlapping the door you can use player is overlapping door which picks the right one.

  • Brilliant... thank you. I've used both nearest to and distance to make it work perfectly.

    Thanks again.

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