Here's a quick working version. Your problems are syntactical. When you got an error it was because of a failure to encapsulate methods properly using {} curly braces.
Often happens when you comment out a conditional statement but forget the closing } further down the code.
Always worth checking before anything else! They must all add up.
Removed CENTER_DIAMETER from ellipseMode() as this is now CENTER, plus I ditched a spurious semi-colon ;
Code:
Ball[] ball;
int objectnumber = 30;
void setup (){
size (500,500);
framerate(30);
ball = new Ball[objectnumber];
for (int i= 0; i < objectnumber; i++){
ball[i] = new Ball(#940B35,random(50,500),random(10,400),random(1,7),random(1,5), 10, 30);
}
}
void draw (){
background(#280915);
//ball[].collide(){
for (int i = 0; i < objectnumber; i++){
ball[i].draw ();
ball[i].move ();
}
}
class Ball {
float size= 10;
float xpos;
float ypos;
float xspeed;
float yspeed;
float diameter;
float diameter2;
color c;
int xdirection = 1;
int ydirection = 1;
Ball (color c_,float xp, float yp,float xs, float ys, float d, float d2){
c = c_;
xpos = xp;
ypos = yp;
xspeed = xs;
yspeed = ys;
diameter = d;
diameter2 = d2;
}
void draw(){
ellipseMode(CENTER);
noStroke();
fill (c);
smooth();
ellipse(xpos,ypos,diameter,diameter);
if (diameter > 10){
diameter--;}
}
void move(){
xpos = xpos +(xspeed * xdirection);
ypos = ypos +(yspeed * ydirection);
if (xpos > width-diameter2*0.5 || xpos < diameter2*0.5){
xdirection *=-1;
diameter = diameter2;
}
if (ypos > height-diameter2*0.5 || ypos < diameter2*0.5){
ydirection *=-1;
diameter = diameter2;
}
/*}
void collide(){
if (xpos == xpos - diameter){
xdirection *=-1;
}
if (ypos == ypos - diameter){
ydirection *=-1;
}
}*/
}
}