How do I link two instances

0 favourites
  • 3 posts
From the Asset Store
Footsteps SFX Two contains 450 sounds of steps and jumps on different surfaces.
  • Say for example I have a button object and a door object. And I have lots of instances of each. What's the best way to link a specific button instance to a door instance.

    I can think of a few possibilities: uids or indexes stored in local variables, but they seem a bit inelegant. Or is there something obvious that I'm missing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add an instance variable for the door and one for the button (i used the name "ID" for both)

    When you add an instance of each object in the layout, set the value of the button instance's variable to the value of the door instance's variable, individualy, on the properties bar to the left, and then add an event to check if they have the same value when you click the button. if it's true, the door opens (in my example, it fades) <img src="smileys/smiley1.gif" border="0" align="middle">

    here, i made an example 'cause i'm not very good explaining <img src="smileys/smiley36.gif" border="0" align="middle">

  • Actually you explained that perfectly. Thanks.

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