# \[HELP\] Firing Projectiles From a Rotating Turret

**URL:** https://forum.kirupa.com/t/help-firing-projectiles-from-a-rotating-turret/229974
**Category:** programming
**Created:** [June 21, 2007, 6:32pm UTC](https://forum.kirupa.com/t/help-firing-projectiles-from-a-rotating-turret/229974 "2007-06-21T18:32:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Capt\_Zeroth](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@Capt\_Zeroth](https://forum.kirupa.com/u/Capt_Zeroth)
#### Post date: [June 21, 2007, 6:32pm UTC](https://forum.kirupa.com/t/help-firing-projectiles-from-a-rotating-turret/229974/1 "2007-06-21T18:32:06Z")

</div>

Hi, Kirupians!

I’m working on a top-view game in which you control a tank that fires from a rotating turret (similar to the _Wii Play_ game _Tanks_). I’ve got the movement and rotation of the turret down, and I’m using this code for the turret rotation:

```auto

_root.onEnterFrame = function(){
    turretRadians = Math.atan2(_ymouse - player._y, _xmouse - player._x);
    turretDegrees = Math.round((turretRadians*180/Math.PI));
    player.player_turret._rotation = turretDegrees;
}

```

That part works just fine, but I’m still having trouble with getting the bullets to fire in the direction I want where I click. I’ve seen [this](http://www.myflashresource.com/flash-tutorials/the-tank-part-2-rotating-and-shooting-the-cannon) tutorial, but I’d prefer to not just rotate a movie clip, as I may program in ricocheting bullets.

Should I be using trigonometry, algebra, or what? Any help would be very appreciated!

[EDIT] By the way, I’m using Flash 8.
