title: How to measure distance between two circles, and then check for collision?
body: <p>i'm making a game in jquery/javascript. And the game is to hit one moving object by using your mouse to click on the screen. I have problem with the detection bit. Is there a jQuery/javascript function that can mesure the distance between the center of the two objects at all time? Becasue then i can easily make a control check the distance of the two centers. and se if the collide. They are both two circles.</p>
  
  <pre><code>&lt;div id="box"&gt;
          &lt;div id="prepend"&gt;
              &lt;div id="hero"&gt;&lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div id="enemy"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Where "box" is the area where the game takes place, "hero" the bullet that you are going to hit the "enemy".</p>