Okay, this is what i've managed to do so far:
http://jpoel.byethost15.com/Swim/Swim_example.swf
But as you can see it isnt smooth at all! Does anyone have any better code i can use?
This is the code i have written to do it:
Code:var px = mouseX; var py = mouseY; this.addEventListener(MouseEvent.MOUSE_MOVE,moveMouse); function moveMouse(e:MouseEvent):void{ var a = mouseY - py; var b = mouseX - px; var radians = Math.atan2(a,b); var degrees = radians / (Math.PI / 180); Cursor.rotation = degrees; Mouse.hide(); Cursor.x = mouseX; Cursor.y = mouseY; px = mouseX; py = mouseY; }
FLA: http://jpoel.byethost15.com/Swim/Swim_example.fla (you might have to right click on that and click "Save target as"




Reply With Quote