title: Way to increment objects inside an array for 2 hit detection c+
body: <p>Im creating a basic game using SDL/C++. I need a way to implement 2 hit detection. When just trying one hit it works fine. Here is what i have for the two hit detection:</p>
  
  <pre><code>  int maxHit = 2;
    int hitCount = 0;
  
    // Detect collisions
    for(auto p : projectiles) {
      for(auto a : aliens) {
  
      if(p-&gt;CollidesWith(a) &amp;&amp; hitCount == maxHit)
      {
          p-&gt;HandleCollision();
          a-&gt;HandleCollision();       
      }  
          if(p-&gt;CollidesWith(a) &amp;&amp; hitCount != maxHit) {  
          ++hitCount; 
        }
      }
  
    }
  </code></pre>
  
  <p>For some reason it works on a select few of the enemies on the screen and doesn't for others.</p>
  
  <p>EDITED TO MAKE IT CLEARER</p>