# Whats wrong with this function?

**URL:** <https://forum.kirupa.com/t/whats-wrong-with-this-function/223269>\
**Category:** Uncategorized\
**Created:** [April 20, 2007, 6:09pm UTC](https://forum.kirupa.com/t/whats-wrong-with-this-function/223269 "2007-04-20T18:09:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phena](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@phena](https://forum.kirupa.com/u/phena)\
**Post date:** [April 20, 2007, 6:09pm UTC](https://forum.kirupa.com/t/whats-wrong-with-this-function/223269/1 "2007-04-20T18:09:46Z")

</div>

```auto

function moveArrows() {
 for(var i:Number = 1; i <= 20; i++) {
  if(_root[arrows*]._y < arrowsGround* + 25) {
   for(var j:Number = 1; j <= 200; j++) {
    if(_root[arrows*].hitTest(_root[enemys[j]].Hhitbox_mc)) {
     enemysHP[j] -= 100
    } else if(_root[arrows*].hitTest(_root[enemys[j]].Bhitbox_mc)) {
     enemysHP[j] -= 50
    } else {
     //rotation formula
     trace(i)
     AX = _root[arrows*]._x
     AY = _root[arrows*]._y
     OAX = _root[arrows*]._x - arrowsXdir*
     OAY = _root[arrows*]._y - arrowsYdir*
     if(AX - OAX >= 0) {
      grad = 1/(Math.PI/180/Math.atan((AY - OAY)/(AX - OAX)))
     }
     if(AX - OAX < 0) {
      grad = 1/(Math.PI/180/Math.atan((AY - OAY)/(AX - OAX))) + 180
     }
     //movement
     _root[arrows*]._x += arrowsXdir*
     _root[arrows*]._y += arrowsYdir*
     arrowsYdir* += gravity
     _root[arrows*]._rotation = grad     
    }
   }   
  } else {
   if(arrowsOldTime* == 0) {
    arrowsOldTime* = Math.round(getTimer() / 1000)
   }
   if(arrowsOldTime* - (Math.round((getTimer()/1000))) == -2) {
    removeMovieClip(_root[arrows*])
   }
  }
 }
}   

```

it traces i, however, the arrow wont move :S, the path is right too, i dont det it…
