# Basic Trig Question

**URL:** <https://forum.kirupa.com/t/basic-trig-question/311076>\
**Category:** flash\
**Created:** [June 27, 2010, 2:04am UTC](https://forum.kirupa.com/t/basic-trig-question/311076 "2010-06-27T02:04:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neuflex](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@neuflex](https://forum.kirupa.com/u/neuflex)\
**Post date:** [June 27, 2010, 2:04am UTC](https://forum.kirupa.com/t/basic-trig-question/311076/1 "2010-06-27T02:04:51Z")

</div>

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.

🙂
