How do I make one object follow after its owner? [Solved]

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I want to make a bubble follow after bad guy and I want several bad guys on screen at once, each with their own following of bubbles.

    I've tried giving the bad guy an ID based on it's UID and the bubble has a 'Owner variable' that matches that ID. I've run it in debug and they have the right values.

    But I can't seem to get them together - when I create a second badguy and a second set of bubbles, the second set of bubbles attaches itself to the first badguy, even though it's owner value does not match that badguys ID at all.

    How would you guys do it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If there is only one bubble for each bad guy, add these objects to a container.

    You will not need to link them by ID or UID, when you pick the guy instance in events, its own bubble will be picked automatically.

    For example:

    For each Guy -> Bubble set position to Guy.x, Guy.Y

    or

    Guy on collision with Player -> Bubble flash for 1 seconds

    When you create a guy, its bubble will be created automatically.

    When you destroy a guy, its bubble will be destroyed automatically.

  • Thanks for the reply.

    There's more than one bubble.

    In the end I used a 'for each' for each bubble. Then pick instances of the bad guy with a UID that matches the ID the bubble has stored in it (which was put there when it was made and matches the bad guy the bubble should be paired with). Then adjust the bubbles positions.

    This seems to give construct the context needed to move the bubbles around properly.

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