Am I the only one who hates the _rotation property? Why would someone prefer -180 to 180 degrees instead of nice 0 to 360? Oh, I’m ranting…
Well, I planned doing a little script to have a movieclip rotate to point towards the mouse cursor. No prob so far, the code looks like this (onEnterFrame handle):
var dx = _root._xmouse - this._x; var dy = _root._ymouse - this._y; var angle = Math.atan2(dx,dy); this._rotation = -(angle/Math.PI * 180);
But then I wanted to ease the motion, so that the moviclip rotates towards the cursor instead of jumping directly to the right position. But that’s where the trouble started - I tried simply to add the rotation and the targeted angle and divide the sum by a constant, but It just wouldn’t work. Somehow I just can’t get the strange behaivor of the _rotation property into my head - any tips?