Sunday, February 18, 2007

Distance Between Two Points (2d)

GEN_get2DDistance = function (ax, ay, bx, by) {
dx = ax-bx;
dy = ay-by;
theDistance = Math.sqrt(dx*dx+dy*dy);
return theDistance;
};
this.onEnterFrame = function() {
trace(GEN_get2DDistance(thing._x, thing._y, _xmouse, _ymouse));
};

No comments: