How to make a rectangle spawn when mouseclicked and will bounce

I’m trying to make another rectangle spawn when mouse is clicked once and it will collide to my first bouncing rectangle and I can add however many i want but my code doesn’t even need me to click and it doesn’t really work.

float rectx,recty,xspeed=7,yspeed=7;

void setup() {
fullScreen();

}
void draw() {
background(0);
rect(rectx,recty,300,150);
fill(0,255,0);
if(mousePressed==true);
rect(recty,rectx,300,150);

if(sideCollision(rectx)) {
xspeed = xspeed * -1;
}
if(topOrBottomCollision(recty)) {
yspeed = yspeed*-1;
}
rectx = rectx + xspeed;
recty = recty + yspeed;
}

boolean sideCollision(float x) {
if(x<0 || x>width-300) {
return true;
} else {
return false;
}
}

boolean topOrBottomCollision(float y) {
if(y<0 || y>height-150) {
return true;
} else {
return false;
}
}

you have an extra semi colon at the end of

if(mousePressed==true);

which is likely causing problems

See here a tutorial about multiple objects bouncing. Just remove gravity.