Question about Actors merging

kietzkietz Member Posts: 49
edited November -1 in Working with GS (Mac)
Hey guys i have a question about how to get an actor to lock onto (or stick to) the position of another moving actor.

Lets say i have actor A and actor B, both actors are moving in space at different directions. What i need is for actor A to stay onto actor B's position when they collide.

The problem im having is that there are multiple actors (A and B) spawning on the screen at the same time so this action of having the actors collide and merge needs to happen only to the actors that actually collide.

Also actor B is moving and i need it to continue its movement after the actors collide.

Basically when actor A touches B they will become one actor but you can still see actor A and actor A still has its properties, they just now are moving together.

Actor B is collide able to other objects and accelerates so it has no determined path. So im really not sure how to fix this problem, Any ideas? Ive looked around but havnt found anything that would work for what i need. If you could even point me in the right direction that would be great.

Much appreciated,

-Kietz

Comments

  • hotMagichotMagic Member, PRO Posts: 266
    Yeah I've done this before.

    When they collide, Constrain actor A's X and Y position to those of actor B. It will stick to it. You can do an offset by constraining to X+10, for example.

    Did you try that method yet?
  • kietzkietz Member Posts: 49
    I have actually tried that, i think the problem is that i have multiple actors on the screen at teh same time. I only want the actors that collide to merge while the rest of the actors float around on screen. Thanks for the advice, im gonna try some more stuff, ill let you know if i get it worked out.

    -Kietz
  • hotMagichotMagic Member, PRO Posts: 266
    Yeah you have to lock them out. Like only do the merge if it both collides and has some flag like Merged =0. Then when it merges, flip that flag to 1.

    Hope that helps!
Sign In or Register to comment.