Okay, so I made this little missile targeting AI:
Here
And as you can see [click to fire a missile], the missile automatically rotate to the new target. I Know why, but what I would like to know, is an efficent, non-laggy script that'll ease it into the rotation.
Any idea? [I've tried using the mx.tweens, some a > _rotation, etc. but rotation goes 0-360, so it makes it act weird...]
Here's my method of getting the rotation:
//Move the missile in the direction it's rotated to
_x += s*Math.sin((_rotation*Math.PI)/180);
_y -= s*Math.cos((_rotation*Math.PI)/180);
//Get rotation
x = this._x-my_target._x;
y = this._y-my_target._y;
a = -Math.atan2(x, y)/(Math.PI/180);
//Set Rotation
_rotation = a;
All of this is on the missile itself, and under onClipEvent(enterFrame){}
where my_target is the movieclip of it's current target.
Ideas?
"Give a man a match, and he'll be warm for a minute, but set him on fire, and he'll be warm for the rest of his life."