Trouble you greatly help thanks


#1

Randomly generate 5,000 balls with a diameter of 10, random colors, and bouncing within the canvas.

When the mouse clicks, a fixed ball (which does not run) is generated at the position where the mouse clicks. When the ball produced in step 1 hits the ball, it also becomes fixed, so one by one. Become a fixed ball until all the balls become fixed balls.

float x, p;
void setup() {
size(600, 800);
x=0;
p=1;
background(#0F0505);
noFill();
stroke(#00E3FF);
}

void draw() {
fill(random(50), random(50), random(50));
translate(width/2, height/2);
rotate(x);
ellipse(x, p, x, p);
x=x+20;
p=p+5;
}


#2

Sorry, but what’s your question? It looks like you just posted your homework assignment?

Where exactly are you stuck?