josedeschamps_JD-Beard_NewSchool_Processing_github_io/Week6/Homework/Week6HW/HWArray4/HWArray4.pde
int NUMBALLS = 200;
float lastTimeCheck;
float timeInterval;
int[] Letter = new int [28];
float[] ballX = new float[NUMBALLS];
float[] ballY = new float[NUMBALLS];
float[] dx = new float[NUMBALLS];
float[] dy = new float[NUMBALLS];

void setup() {
  size(800,800);
  
  noStroke();
  textAlign(CENTER, CENTER);
  lastTimeCheck = millis();
  timeInterval = 5000;
  
  for (int i = 0; i < NUMBALLS; i++) {
    ballX[i] = width/2;
    ballY[i] = height/2;
    dx[i] = random(-10,10);
    dy[i] = random(-10,10);
    
   
  }
}

void draw() {
 background(20);
  
  
  
  
  
  
  for (int i = 0; i < NUMBALLS; i++) {
    
    fill(map(i,0,NUMBALLS,50,255),random(0,255),255);
   
    rect(ballX[i], ballY[i], i-80, i-80);
    point(ballX[i],ballY[i]);
    fill(0);
    text("hi", ballX[i]+50, ballY[i]+50);
    ballX[i] += dx[i];
    ballY[i] += dy[i];
    
    if (ballX[i] > width || ballX[i] < 0) {
      ballX[i] -= dx[i];
      dx[i] = -dx[i];
    }
    
    if (ballY[i] > height || ballY[i] < 0) {
      ballY[i] -= dy[i];
      dy[i] = -dy[i];
    }
    
    if(millis() > lastTimeCheck + timeInterval){
    
  lastTimeCheck = millis();

   for (int j = 0; j < NUMBALLS; j++) {

   ballX[j] = 0;
   ballY[j] = map(j,0,NUMBALLS,0,width);
   dy[j] = 0;
  }
  }
 
    }
     
}






  