弧度度的关系 鼠标跟随 碰撞角度==

/*舞台上有mc1,mc2*/

var speed:Number = 2;

var dx:Number = mc1.x - mc2.x;

var dy:Number = mc1.y - mc2.y;

var dist:Number = Math.sqrt(dx * dx + dy * dy);

var radians:Number = Math.atan2(dy,dx);//弧度

var drgress:Number=radians*180/Math.PI;//弧度转化成度

//(radians=drgress/(180/Math.PI)||radians=drgress/180*Math.PI)

trace(drgress);

var vx:Number = Math.cos(radians) * speed;

var vy:Number = Math.sin(radians) * speed;

你可能感兴趣的:(==)