title: AS3 - How To - Enemy Shoot Bullet Diagonally?
body: <p>My code instructs the Enemy that when the Target gets within a certain distance that the Enemy fires a bullet at the Target, either left/down(diagonal), down, or right/down(diagonal).
  My problem is: the Bullet fires fine but, once the Target is no longer within the set distance - the Bullets curves to down(y+) rather than just continuing on it's initial trajectory. </p>
  
  <pre><code>private function loop(e:Event) : void
      {
  
          y += vy;
          x += 0;
          x -= 0;
          if ((target.x - x) &gt; (target.y - y) &amp;&amp; (getDistance(target.x, target.y, x, y) &lt; interestDistance / 2))
                x += 5;
  
          if ((target.y - y) &gt; (target.x - x) &amp;&amp; (getDistance(target.x, target.y, x, y) &lt; interestDistance / 2))
                x -= 5;
  
  
  
          if (y &gt; stageRef.stageWidth || y &lt; 0)
          removeSelf();
      }
  </code></pre>
  
  <p>What can I add to the code to kees the Bullet moving in it's original trajectory regardless of where the Target has moved to?</p>
  
  <p>Thank you for your time.</p>