/*//////////////////////////////////////////////////////////////////////////////////////////////
 * Germ Dodger by Nima Gholipour
 * Student ID: 991391215
 * Intstructions:
 *   The player has to try and dodge the incoming waves of germs using the mouse to move only up and down
 *
 //////////////////////////////////////////////////////////////////////////////////////////////*/


// declare variables
int germNumber=50;
White whiteCell;

Germs[] germCell;

void setup() {

  //set windows size
  size(400, 400);

  noStroke();

  //initialize player white blood cell
  whiteCell = new White();

  //initialize the number of germs
  germCell = new Germs[germNumber];

  //declare germ values
  for (int i=0; i<germCell.length; i++) {
    germCell[i]=new Germs(random(400), random(400), random(20, 50), random(20, 50), color(random(255), random(255), random(255)), random(-1, 1), random(-1, 1));
  }
}



void draw() {

  //call functions
  drawBackground();
  whiteCell.drawPlayer();

  //make the germs move
  for (int i=0; i<germCell.length; i++) {
    germCell[i].germUpdate();
  }
  // display the germs
  for (int i=0; i<germCell.length; i++) {
    germCell[i].drawGerm();
  }
}

void drawBackground() {

  //level background
  background(255);
  rectMode(CORNER);
  fill(#e09faa);
  rect(0, 0, 400, 40);
  fill(#c77f8b);
  rect(0, 40, 400, 60);
  fill(#ba707c);
  rect(0, 100, 400, 40);
  fill(#a45d69);
  rect(0, 140, 400, 120);
  fill(#ba707c);
  rect(0, 260, 400, 40);
  fill(#c77f8b);
  rect(0, 300, 400, 60);
  fill(#e09faa);
  rect(0, 360, 400, 40);
}