works a treat on two set mC clips...
I also need to work out or find help on:
the screen is filled with mc's so when they bnag into each other i need them to rotate towards each other.
How do I find out what the name of the one it has bump into?
here's the code that looks to see if they have collided:
posX = new Array();
posY = new Array();
//random rotate
rotate = new Array(45, 90, 270, 180, 135, 315, 225, 45);
// gangA
gangAhit = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
//
function updateArrayA() {
for (i=0; i<gangAhit.length; i++) {
for (j=0; j<gangAhit.length; j++) {
if (i != j) {
if ( gangAhit[i]!= 2 && gangAhit[j]!=2){
if (Math.abs(posx[i]-posx[j])<20) {
if (Math.abs(posY[i]-posY[j])<20) {
if (i<8 && j<8) {
gangAhit[i] = 1;
gangAhit[j] = 1;
a = random(8);
_root[i]._rotation = rotate[a];
_root[i]._x += random(5)-1;
_root[i]._y += random(5)-1;
} else if (i>7 && j>7) {
gangAhit[i] = 1;
gangAhit[j] = 1;
a = random(8);
_root[i]._rotation = rotate[a];
_root[i]._x += random(5)-1;
_root[i]._y += random(5)-1;
} else if (i<8 && j>7) {
gangAhit[i] = 2;
gangAhit[j] = 2;
_root[i].gotoAndPlay(10);
_root[j].gotoAndPlay(10);
} else if (i>8 && j<7) {
gangAhit[i] = 2;
gangAhit[j] = 2;
_root[i].gotoAndPlay(10);
_root[j].gotoAndPlay(10);
}
} else
{