# Angle w/ trig

**URL:** <https://forum.kirupa.com/t/angle-w-trig/222233>\
**Category:** flash\
**Created:** [April 11, 2007, 8:00pm UTC](https://forum.kirupa.com/t/angle-w-trig/222233 "2007-04-11T20:00:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esoltas](https://avatars.discourse-cdn.com/v4/letter/e/5e9695/32.png) [@Esoltas](https://forum.kirupa.com/u/Esoltas)\
**Post date:** [April 11, 2007, 8:00pm UTC](https://forum.kirupa.com/t/angle-w-trig/222233/1 "2007-04-11T20:00:32Z")

</div>

I have a game that I’m making, and regardless of other stuff, I need to make essentially a turret. I know how to code where it should move towards (that’s easy), and I know somewhat how to use math stuff on flash. But when I tried to implement it on this, it doesn’t work. See code:

angleA = Math.atan2(TARGET.\_y-HERO.\_y, TARGET.\_x-HERO.\_x);  
var degrees = angleA/(Math.PI/360);  
BULLET.\_rotation = degrees;

It is correctly placed, don’t worry about that.
