I did it !!! I find out a way to do it, in fact (like I tried to do at the beginning) I created arrays also for x,r,y and m values, but now, with your advices I remade it properly ,so now it works!! (don't worry, my project is far to be finished so I think that in several days I'll comeback with a new problem XD) So Thanks a lot everyone
!
here is it :
Code:
Boule[] boules;
float[] x = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
float[] y = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
float[] r = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
float[] m = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
float gravite;
void setup() {
size(400,400);
smooth();
boules = new Boule[2];
r[0] = 10;
x[0] = 100;
y[0] = 10;
m[0] = 3;
r[1] = 25;
x[1] = 250;
y[1] = 300;
m[1] = 3;
for(int i=0; i<boules.length; i++){
float dr = r[i];
float dx = x[i];
float dy = y[i];
float dm = m[i];
boules[i] = new Boule(dr,dx,dy,dm,i);
}
gravite = .015;
}
void draw() {
background(255);
for(int i=0; i<boules.length; i++){
boules[i].action();
}
}
just a last question about this , is there a way to not write {0,0,0,0,0,0,0,0,0,0,0....} to initialize values?