avoid mouse 1372 days ago Quote('103365','103365','6','1236')">Report spamframe code:
MovieClip.prototype.avoidMouse = function (distance, speed, accel)
{
var _loc3 = this._parent._xmouse - this._x;
var _loc2 = this._parent._ymouse - this._y;
var _loc6 = Math.sqrt(_loc3 * _loc3 + _loc2 * _loc2);
if (_loc6 < distance)
{
var _loc5 = Math.atan2(_loc2, _loc3);
if (accel)
{
speed = Math.min(speed, accel * distance / _loc6);
} // end if
this._x = this._x - Math.cos(_loc5) * speed;
this._y = this._y - Math.sin(_loc5) * speed;
} // end if
};
mc:
onClipEvent (enterFrame)
{
this.avoidMouse(100, 15, 3);
// this.constrainTo(_root.box);
//this._rotation-=30;
}
Comments: 1 Views: 138456
|