# AS1, array bullet help!

**URL:** <https://forum.kirupa.com/t/as1-array-bullet-help/147592>\
**Category:** Uncategorized\
**Created:** [May 11, 2005, 10:09pm UTC](https://forum.kirupa.com/t/as1-array-bullet-help/147592 "2005-05-11T22:09:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AriesMK](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@AriesMK](https://forum.kirupa.com/u/AriesMK)\
**Post date:** [May 11, 2005, 10:09pm UTC](https://forum.kirupa.com/t/as1-array-bullet-help/147592/1 "2005-05-11T22:09:29Z")

</div>

Hi, everyone i am new to this forum aswell as pretty new to action script. But i am learning fast. I was wondering if someone who knows alot about action script could help me. I am try to make my bullets rotate to the angle my crosshair is pointed at and im having no luck.:-/

P.S : my code isnt commented sorry :shifty:

```auto
 bcount = 10;
Mouse.hide();
bA = new Array();
rotate = new Array();
kess = new Array();
attachMovie("xhair", "x_mc", 5);
attachMovie("ship", "s_mc", 1);
s_mc._x = 275;
s_mc._y = 380;
function mouseM() {
 mouse.hide();
 x_mc._x = _xmouse;
 x_mc._y = _ymouse;
}
function bulletAim(){
 for (i=10; i<bcount; i++) {
 cdis = _root["b_mc"+i]._x - s_mc._x;
 kdis = _root["b_mc"+i]._y - s_mc._y;
 kess = Math.atan2(cdis, kdis);
 kess = kess*180/Math.PI;
 _root["b_mc"+i]._rotation = kess
 }
}
function shipMove(){
 xdis = x_mc._x-s_mc._x;
 ydis = x_mc._y-s_mc._y;
 j = Math.atan2(ydis, xdis);
 rotate = j*180/Math.PI;
 s_mc._rotation = rotate;
 }
function moveShip() {
 if (key.isDown(key.RIGHT)) {
  s_mc._x += 10;
 }
 if (key.isDown(key.LEFT)) {
  s_mc._x -= 10;
 }
}
function moveB() {
 onMouseDown = function () {
  attachMovie("bullet", "b"+bcount, bcount);
  _root["b"+bcount]._x = s_mc._x;
  _root["b"+bcount]._y = s_mc._y;
  xdist = x_mc._x-s_mc._x;
  ydist = x_mc._y-s_mc._y;
  bA[bcount] = Math.atan2(ydist, xdist);
  bcount++;
 };
}
function moveBullets() {
 for (i=10; i<bcount; i++) {
  _root["b"+i]._x += 10*Math.cos(bA*);
  _root["b"+i]._y += 10*Math.sin(bA*);
 }
}
onEnterFrame = function () {
 bulletAim();
 shipMove();
 rShip();
 moveShip();
 moveB();
 moveBullets();
 mouseM();
};
 

```
