title: JavaScript Collision Detection doesn't seem to be working?
body: <p>So I'm trying to set-up Collision Detection in my rendition of Alien Invaders. But it hardly works. And by hardly I mean I've never gotten a valid hit, or <code>true</code> return. I've even tried a bunch of different methods, but for whatever reason I haven't been able to get a correct answer.</p>
  
  <p>The Collision Detection is for the Players bullet firing to the Alien ships, just for clarification, if it matters :D.</p>
  
  <p>Here is the Collision Detection code: (I tried to make it error prone, in hope for a hit, although no method seems to work)</p>
  
  <pre><code>var isCollidingWithAlien = function(shot){
      var alienImg = document.getElementById('alien');
      for(var i = 0; i &lt; aliens.length; i++){
          return shot.x               &lt; aliens[i].x + alienImg.width  &amp;&amp; 
          shot.x + shot.img.width     &gt; aliens[i].x                   &amp;&amp;
          shot.y                      &lt; aliens[i].y + alienImg.height &amp;&amp; 
          shot.y + shot.img.height    &gt; aliens[i].y;
      }
  };
  </code></pre>
  
  <p>It's not that the code isn't being called, or some strange technical error. It just never returns true.</p>
  
  <p>Also if you want to view all code, here is a <a href="http://jsfiddle.net/v3qsM/6/" rel="nofollow"><strong>JSFiddle</strong></a></p>
  
  <p>@Update:
  Been playing with the code, and it seems to register correctly for the first Alien created, the one on the top left if you look at the JSFiddle. Not sure why though</p>