title: How to hittest for all instances of a movieclip - ACTIONSCRIPT 2
body: <p>I am making a tower defense game, and have gotten it to the point that my towers shoot bullets at appropriate intervals.  But I need to be able to remove the movieclips.  For example, if a tower shoots a bullet, it makes a copy of the bullet movieclip, which is aimed at a duplicate of the specific enemy.  However, I cannot figure out how to configure the hitTest.  Is there any way to gt the hittest to check for all child movieclips duplicated from a specific object?</p>
  
  <p>EDIT:  I added this function, which is to execute every second.  But for some reason, it does not confirm the hits.</p>
  
  <pre><code>function checkHits(){//checks for hits between enemies and bullets
  for (var zz = 0; zz &lt; bulletArray.length; zz += 1)//checks for each bullet
  {
      for(var yy=0;yy&lt;enemiesArray.length;yy+=1){//checks for each enemy
          trace("enemies loc"+yy+":"+enemiesArray[yy]);
          trace("bullet loc"+zz+":"+bulletArray[zz]);
          if(bulletArray[zz].hitTest(enemiesArray[yy])){
              trace("HIT!");
             removeMovieClip(bulletArray[zz]);
             removeMovieClip(enemiesArray[yy]);
             bulletArray.splice(zz,1);
             bulletArray.splice(yy,1);
             }//end if
      }//end for
  }//end for
  </code></pre>
  
  <p>}</p>
  
  <pre><code>function dupeCircle()
  {
  //trace("Dupe circle initiated");
  duplicateMovieClip(circlebase, "_root.circle" + circleCount, circleCount);
  bulletArray.push("circle" + circleCount);
  trace(bulletArray[0]._width);
  circleCount += 1;
  }
  </code></pre>
  
  <p>This is the code for the object which adds the circles.</p>