Open/Close Doors (Multiple Objects)

  • Hello, I have some problems with the doors. How can I control multiple doors individually? Thank you for your help.

    Here is the *.capx file:

    dropbox.com/s/lw4wpwajvpgxge3/Door_Actions.capx

  • I imagine the same way you'd do anything that involved multiple instances... Use the condition and select a specific door by it's UID...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's was my first idea, but how I can control UID's?

  • I just give them an instance variable (I call it "which") and then assign them a number myself (1, 2, etc.). Then I just say

    If door.which =1

    Then do whatever you want.

  • I like to use the IID instead of the UID, because it's fixed.

    If you hardcode using the UID, you could accidentally change all the UIDs in your game and you'd have to change each line of code manually (at least that happened with C2 a while ago, not sure if this still happens).

    Let's say you have 3 doors in a layout; if you pick them by IID, their respective numbers will be 0, 1 and 2, in the order they were created.

    IF player entered door

    AND door.IID = 0

    -> Go to layout

  • That's was my first idea, but how I can control UID's?

    No need to make anything messy like that, here is one way to do it: door example

    C-7 Isn't that exactly duplicating what UID's are meant for? :)

  • > That's was my first idea, but how I can control UID's?

    No need to make anything messy like that, here is one way to do it: door example

    C-7 Isn't that exactly duplicating what UID's are meant for? :)

    Oh thank you! I can not tell you how grateful I am to you! You make my day! Thank you very much! ;D

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