class Bullet extends Boxish{
  
  int type;
  
  
  Bullet(Tank t){
    super(0,0,0,0);
     x = t.x+(t.w*4/10);
     y = t.y-(t.h/2);
     w =   t.w/10;
     h = t.h;
     type = UP;
     c = WHITE;
 } 
 
   void move(){
     if(type == UP){
       y-=BULLET_SPEED;
       //println(BULLET_SPEED);
     }
     if(type == DOWN){
        y+=BULLET_SPEED; 
     }
   }
   
   boolean checkHit(Fleet f){
    strokeWeight(1);
    stroke(255);
     if(type == UP){
       for(Invader i:f.invaders){
        // i.showOutline();
        if(i.hit(this)){
               invadersToKill.add(i);
               i.doParticles(false);
               return true;
        }  
       }
       for(Invader i:invadersAttacking){
             //     i.showOutline();
        if(i.hit(this)){
               invadersToKill.add(i);
               i.doParticles(false);
               return true;
        }  
       }
       /* for(Brick b:bricks){
           if(b.hit(this)){
              bricksToKill.add(b);
              return true;
           } 
        }*/
         
           
       }
       return false;
     } //end checkhit
   
}