title: How to use a parabola formula in AS3 for firing an arrow that will always intercept a given point
body: <p>First note: mathematically, I'm not that skilled at all.</p>
  
  <p>I played a game on iPhone a while back where you press a point, and an arrow fires from your castle which will always intersect the point you pressed. I wanted to make a similar game, thinking it would be an easy quick make; then I ran into the realization that the mathematics for this is actually beyond my skill level.</p>
  
  <p>I'm assuming they're using a parabola formula or something which would determine the velocity and angle needed when the arrow is launched for the arrow to always intersect the clicked point.</p>
  
  <p>I only vaguely remember how parabolas work from school and have no chance of working out any formulas.</p>
  
  <p>Any mathematical help or ideas that might be easier to implement would be great.</p>
  
  <p>I want to end up with a function in my castle like so:</p>
  
  <pre><code>package
  {
      import avian.framework.objects.AvElement;
  
      public class Castle extends AvElement
      {
          /**
           * Fires an arrow from this
           * @param ix The x intersection point
           * @param iy The y intersection point
           */
          public function fire(ix:Number, iy:Number):void
          {
              var ar:Arrow = new Arrow();
  
              ar.x = x;
              ar.y = y;
  
              // define angle and velocity based on ix, iy
              // ar.fireAngle = ??
              // ar.fireVelocity = ??
  
              parent.addChild(ar);
          }
      }
  }
  </code></pre>
  
  <p><strong>Update</strong> as per questions in comments:</p>
  
  <p>There will be no forces applied to the arrow such as wind, friction, etc. Also, the starting point of the arrow is fixed throughout the game (at the castle).</p>
  
  <p>Here is an example image for slightly more clarity:
  <img src="https://i.stack.imgur.com/Uu0Ml.gif" alt="Arrow path"></p>
  
  <p>To be as clear as possible:</p>
  
  <ol>
  <li>Arrow always begins its journey from a fixed point (say: 40, 120).</li>
  <li>The arrow must always intercept a given coordinate.</li>
  <li>A realistic as possible path is something I'd like to achieve (obviously I can just fire an arrow straight to intercept any point, but the <strong>goal</strong> is to have the arrow first rise, then descend; passing through the desired coordinate at the most realistic point in its journey).</li>
  </ol>
  
  <p><strong>Note:</strong> To avoid the issue of there being infinite possible parabolas - the velocity of the arrow can be fixed - just look at defining the angle the arrow can leave at.</p>