function handleCollisions() {
  // check if the bullit and enemy collide
  playerBullets.forEach(function(bullet) {
    playerEnemies.forEach(function(enemy) {
      if (collides(bullet, enemy)) {
        bullet.active = false;
        enemy.active = false;
        score+=100;
      }
    });
  });

  // check if the player and enemy collide
  playerEnemies.forEach(function(enemy) {
    if (collides(enemy, player)) {
      enemy.active = false;
      score = 0;
      updateFrames = false;
      canvas.font = "30px Impact";
      canvas.fillText("GAME OVER!",130,100);
    }
  });


}
// this function checks if objects collide with things
this function checks if objects collide with things
this function checks if objects collide with things
function handleCollisions() {
  playerBullets.forEach(function(bullet) {
    playerEnemies.forEach(function(enemy) {
      if (collides(bullet, enemy)) {
        bullet.active = false;
        enemy.active = false;
        score+=100;
      }
    });
  });
  playerEnemies.forEach(function(enemy) {
    if (collides(enemy, player)) {
      enemy.active = false;
      score = 0;
      updateFrames = false;
      canvas.font = "30px Impact";
      canvas.fillText("GAME OVER!",130,100);
    }
  });
}
function handleCollisions ( ) { playerBullets . forEach ( function ( bullet ) { playerEnemies . forEach ( function ( enemy ) { if ( collides ( bullet , enemy ) ) { bullet . active = false ; enemy . active = false ; score += 100 ; } } ) ; } ) ; playerEnemies . forEach ( function ( enemy ) { if ( collides ( enemy , player ) ) { enemy . active = false ; score = 0 ; updateFrames = false ; canvas . font = "30px Impact" ; canvas . fillText ( "GAME OVER!" , 130 , 100 ) ; } } ) ; }
this function checks if objects collide with things
this function checks if objects collide with things
// check if the bullit and enemy collide // check if the player and enemy collide