Basic Trig Question

Hello All :-),

I am pretty new to flash and actionscripting tho I have been programming for awhile (never games tho). I thought it would be cool to try and write some flash games so I have been messing about with flash cs3 and reading a few books. Anyhow…

I am having a few problems trying to fire off a sprite at a certain angle. On a timer event I am trying to add a new sprite to the screen and direct it to another sprite on the screen.

I know I can use arctan to work out the angle. Hence: -

dx = sprite.x - sprite1.x;
dy = sprite.y - sprite1.y;

radians:Number = Math.atan2(dy, dx);

but from this I don’t know how to take this to modify a sprites x and y properties to fire it off at that angle.

Any help would be much appreciated.

:slight_smile: