// The bouncing ball example // DS, ICM 2005 // Max number of balls int MAX = 6; float boxHeight = 200; // Declare array of balls Ball[] balls = new Ball[MAX]; //our setup function void setup() { size(400,200); smooth(); // Initialize array for (int i = 0; i < MAX; i++) { balls[i] = new Ball(i); //println("ball " + i + " " + balls[i].xspeed); } } void draw() { background(255,255,255); //println(boxHeight); //if (boxHeight > 700) { // boxHeight--; //} //else { // boxHeight++; //} // Loop through all balls for (int i = 0; i < MAX; i++) { balls[i].go(boxHeight); } }