hello, i once saw blanious's collide reaction script , well i got the whole collide thing , but i never understood the circular collide script , can anyone give me the correct script plus a small movie file for example ?
//*************************************
//simple distance test
//*************************************
function distance(element1,element2)
{
a=element1.x - element2.x;
b=element1.y - element2.y;
return sqrt (a*a+b*b);
}
//*************************************
//Circle Collide uses distance test function
//*************************************
function circleCollide(element1,element2)
{
//get width of both elements
width1=(element1.getBounds().xMax-element1.getBounds().xMin)-6
width2=(element2.getBounds().xMax-element2.getBounds().xMin)-6
//get distance
dist=distance(element1,element2);
//account for different sizes
width=(width1/2)+(width2/2);
//check distance and size
//return t/f
return dist<=width
}
basically it uses distance to determine if the objects are colliding.
eh.... well i hope its not too much truble sending me a .movie file so i could see exacly where those lines goes ... i hardly know anything about collisions so...