There's a couple of operators you seem to be unaware of.
++ and --
They add or subtract only one from a variable but they're also much faster than saying x += 1 or x = x + 1 (and quicker to type).
You might find managing your ellipses easier if you made objects out of them. I've put an example below of how you might do it, showing how objects do the handy trick of looking out for themselves.
Code:MyEllipse [] myEllipse = new MyEllipse[25];
void setup(){
size(300, 300);
for(int i = 0; i < myEllipse.length; i++){
myEllipse[i] = new MyEllipse((i % 5) * 50, (i / 5) * 50, 40, 40);
}
}
void draw(){
background(0);
smooth();
for(int i = 0; i < myEllipse.length; i++){
myEllipse[i].draw();
}
}
class MyEllipse{
float x, y, wide, high;
MyEllipse(float x, float y, float wide, float high){
this.x = x;
this.y = y;
this.wide = wide;
this.high = high;
}
void draw(){
if(over()){
fill(255);
}
else{
fill(255, 255, 0);
}
ellipse(x, y, wide, high);
}
boolean over(){
if(dist(mouseX, mouseY, x, y) < wide / 2){
return true;
}
return false;
}
}
If you're not au fait with classes and objects, Shiffman does a better job of explaining it than I can:
http://itp.nyu.edu/icm/shiffman/week3/index.html