import java.awt.*;

public class GENERIC_ENEMY{

  int x, LEN;
  GENERIC_CELL cells[];

  GENERIC_ENEMY(){
    //enemy configuration defined in extending class
  }

  public void moveDown(){
    for(int i=0; i<LEN; i++)
      cells[i].y+=2;
  }

  public int getY(int i){
    return cells[i].y;
  }

  public int check_collision(int px, int py){
    for(int i=0; i<LEN; i++){
      if(px==x && py>getY(i)-2 && py<getY(i)+2 && 
         getColor(i)==Color.blue) return 1;
      else if(px==x && py>getY(i)-2 && py<getY(i)+2) return -1;
    }
    return 0;
  }

  public Color getColor(int i){
    return cells[i].getColor();
  }    

  public void draw(Graphics g){
    for(int i=0; i<LEN; i++){
      cells[i].draw(g);
    }
  }
}

