I am trying to get two movies to lock together when they collide. Does anyone have any suggestions on this? I will list my details below.
I am trying to simulate the bonding of antigens and antibodies. To do this I have two movieclips named antigen and antibody respectively. These are duplicated as the user clicks on one of two buttons with the following:
on (release) {
duplicateMovieClip ("_root.antibody", “antibody”+i, i++);
}
Both of the objects float around on the stage as they are duplicated. Antibodies are little Y-shaped objects. The two tips of the Y will each attach to an antigen. I placed a little invisible button on each of the two tips.
Now here is my problem! I am trying to say when this button collides with one of the incremented antigens it will set the x-position of this button to some x-position on the movie it collided with.
if (this.hitTest(_root[“antigen” +i])){
this._x = _root.[“antigen”+i]._x
this._y = _root.[“antigen”+i]._y
}
Can someone tell me if I am even heading in the right direction? I definitely appreciate any help available.