(adsbygoogle = window.adsbygoogle || []).push({});
I am trying to make my character rotate so he is always looking at the mouse. It rotates 20 degrees then stops.
This is my code i am using to get him to rotate.
public function playerRotate():void {
var xlength:Number = mouseX - this.x;
var ylength:Number = mouseY - this.y;
var angle:Number = Math.atan2(ylength, xlength) *180/ Math.PI;
trace(angle + "angle");
this.rotation = angle;
}
I don't get any errors from this code.
Screen Shots of character Rotation When mouse is at (TOP LEFT, TOP RIGHT, BOTTOM RIGHT, BOTTOM LEFT)
[ATTACH=CONFIG]17361[/ATTACH][ATTACH=CONFIG]17362[/ATTACH][ATTACH=CONFIG]17363[/ATTACH][ATTACH=CONFIG]17364[/ATTACH]
If you need to look through all my programming to find problem. Private message I'll add you on Skype.