How to determine which enemy is hit and destroy it alone
<p><a href="http://jsfiddle.net/5DB6K/" rel="nofollow">http://jsfiddle.net/5DB6K/</a></p>

<p>I have this game being made where you shoot enemies from the sides of the screen. I've got the bullets moving and being removed when they reach the end of the screen (if they didn't hit any enemy) and removing the enemy when they collide with it. </p>

<pre><code>//------------collision----------------//
        if(shot === true){

            bulletY = $('.bullet').position().top + 2;
            bulletX = $('.bullet').position().left + 2;

            $('.enemy').each(function(){

                if($('.enemy').hasClass('smallEnemy')){
                enemyY = $(this).position().top + 7;
                enemyX = $(this).position().left + 7;

                if(Math.abs(bulletY - enemyY) &lt;= 9 &amp;&amp; Math.abs(bulletX - enemyX) &lt;=9){

                    $(this).remove();
                    score = score + 40;
                    bulletDestroy();

                }
              }

           });
        }
</code></pre>

<p>However, the bullet destroys every enemy if the collision check is right which isn't what I want. I want to check if the enemy has the class of either smallEnemy, medEnemy, or lrgEnemy and then do the collision check which is what I thought I had but it doesn't seem to work. </p>

<p>Also, the game starts to lag the more and more time goes on. Would anyone know the reason for that?</p>
