if (!isInvincible) { if(aliens.size() > 0){ //Check to see if the national guard has been called
for(int i = 0; i < aliens.size(); i++){ //For every alien that exists
float aliensX = aliens.get(i).getX(); //Store the X value of the alien ship in a variable float aliensY = aliens.get(i).getY(); //Store the Y value of the alien ship in a variable if(shipX <= aliensX + 12.5 && shipX >= aliensX - 12.5 && shipY <= aliensY + 11 && shipY >= aliensY - 11){ shipFrames = frameCount; //Frame counter for ship debris sDebris = new ShipDebris(shipX, shipY); reset(); //reset the starting parameters cannons.clear(); //Remove all cannon bullets after ship crash lives--; //Reduce the amount of ships remaining by one time = millis(); //Set point in time equal to elapsed time at point of collision isInvincible = true; //Set invincibility to true } } }