Processing Forum
Catcher catcher;
FancyRaindrop[] raindrops;
int score = 0;
void setup() {
size(200,200);
smooth();
catcher = new Catcher(20);
raindrops = new FancyRaindrop[100];
}
void draw() {
background(255);
for(int i = 0; i < raindrops.length; i++)
if (raindrops[i] == null || raindrops[i].reachedBottom()) {
raindrops[i] = new FancyRaindrop(random(width),random(5,10),random(.5,3),color(0,0,255));
break;
}
for(int i = 0; i < raindrops.length; i++)
if (raindrops[i] != null && !raindrops[i].reachedBottom())
raindrops[i].move();
catcher.setLocation(mouseX,mouseY);
for(int i = 0; i < raindrops.length; i++) {
if (raindrops[i] != null && !raindrops[i].reachedBottom()) {
if (catcher.intersects(raindrops[i]))
score++;
raindrops[i] = null;
else
raindrops[i].display();
}
}
catcher.display();
}