How do I separate two object instances?

  • The problem I'm having is with the 'tilt' and 'hinge' set of objects. As probably noticeable in the game, the 'tilt' platform is connected to the 'hinge' object via a distance joint. However, I want to use more of these two objects in the level. Whenever two of them are on the screen at once, they'll assume they're all connected to each other and not work.

    How do I separate each instance of the variable and call only to a specific instance so each one works only with another specific one?

    Also, any input and optimization to what I have at the moment would be greatly appreciated!

    capx link: megafileupload[DOT] com /1UE4/tilt_game.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Putting the tilt and the hinge in a container would do the trick..

    Another way would be for each tilt hinge pick nearest to tilt.x,tilt.y - create revolute joint..

    Other ways would be to give them instance variables and check if they are the same..

  • Putting the tilt and the hinge in a container would do the trick..

    What do you mean by 'container'? As in a family or something different?

    I'm also confused about how to pick a nearest for the x/y for tilt/hinge.

  • From the manual:

    https://www.scirra.com/manual/150/containers

    And if you could explain your confusion, it might be easier to take it away..

  • And if you could explain your confusion, it might be easier to take it away..

    Thanks for the link to the manual.

    I'm confused in the sense that I'm not sure how I could express choosing the closest in code form.

  • Create an event:

    Sprite pick nearest to

    It's just one of the many conditions

  • Create an event:

    Sprite pick nearest to

    It's just one of the many conditions

    Nice one, thanks.

    I created a container for the objects and it seems to work perfectly. Thanks a lot man, you've been a huge help!

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