Need help understanding how these lines of codes work. I know they are variables and methods, but beyond that I’m confused.
//
int x=50;
Circles[]circle=new Circles [x];
//
void setup(){
size(800,600);
frameRate(120);
//
for(int i=0;i<circle.length;i++){
circle[i]=new Circles();
}
}
//
void draw(){
for(int i=0;i<circle.length;i++){
circle[i].move();
circle[i].display();
}
}
//
class Circles{
float x;
float y;
float xspeed;
float yspeed;
float circlesize;
//
Circles(){
x=random(100,700);
y=random(100,700);
xspeed=random(0.5,1);
yspeed=random(0.5,1);
circlesize=random(40,100);
}
//
void move(){
x =x+xspeed;
y =y+yspeed;
if(x+(circlesize/3)>800||x-(circlesize/3)< 0){
xspeed=xspeed*-1;
}
if(y+(circlesize/3)>600||y-(circlesize/3)< 0) {
yspeed=yspeed*-1;
}
}
//
void display() {
fill(254,127,156);
ellipse(x,y,circlesize,circlesize);
}}