How do I get two objects to stay together?

0 favourites
  • 4 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • Alright I'm going to try to explain this the best way I can. I'm trying to place two images together, (a right ledge and a left ledge from a tiles for a tilemap). I set them up as one sprite. The left edge as frame one and the right edge as frame 2. I set the speed to 0 so no real animation plays. Both ledges are supposed to come together to make one moving platform. I set the code up for them both to move correctly, but how do I "pin" them together to move as one object? At the moment they move in opposite directions. I tried using the pin behavior with some code but It did not work?

  • For pin behavior, try using debug to confirm you are pinning to the correct object instance, picking instances can sometimes get tricky when referring to the same object.

    Once you have pinned one to the other, you no longer use actions to move the pinned object. When you move the object it is pinned to, both will move.

    In this situation though, you probably don't need the pin behavior at all. As both edges of your platform are the same object with different animation frames, an action that makes that object move should move both/all instances of that object at the same time. Just make sure the ones you want to move are picked correctly with conditions.

  • I would have a 3rd invisible object with deactivated collisions, and then activate it when they come together. You pin the other 2 to this one and forget about them

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How do you use debug?

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