Combine 2 codes

Hello guys,
I’ve a question : The thing is that I have 2 codes and I want to combine them like this ; the basic code would be the image of DVD mooving across the screen and then put a mousePressed line so when we press the mouse the other codes appears but I really don’t know how to combine 2 void draw and setup into one and evreything so if someone understood what I’ve said and would be able to change my code or to help me it would be amazing ^^.
The code :

PImage dvd;
float b;
float d = 1; 
float speedX = 3;
float speedY = 3;
float x = random(width);
float y = random(height);
void setup (){
  fullScreen();
  dvd = loadImage ("dvd.png");
}
void draw () { background (255);
bouger(); 
couleurs();
}
void couleurs() {
b = b + d;
tint (b, 255-b, b);
if (b > 255 || b < 0) { d = d * -1;}
}
void bouger() {
 x = x + speedX;
 y = y + speedY;
if (x < 0 || x > width - 339) { speedX = speedX * -1;} 
if (y < 0 || y > height - 149) { speedY = speedY * -1;}
image (dvd,x,y);
}

And the second :

bug[] bugs = new bug[2000];
void setup() {
  fullScreen();
  for (int i = 0; i < bugs.length; i++) {
    bugs[i] = new bug();
  }
}
void draw() {  
  for (int i = 0; i < bugs.length; i++) {
    bugs[i].fall();
    bugs[i].show();
  }
}

And on the other outlet of the same code the class “bug” :

class bug {
  float x = random(width);
  float y = random(-200,-100);
  float speedY = random(4,10);
  float taille = random (50, 70);
  void fall() {
    y = y+speedY;
    
    if (y > height) {
      y = random (-200,-100);
    }
  }
  
  void show() {
    fill(0);
    line(x,y,x,y+taille);
  }
  }

is that a school project?

Nit for school but I have to give a code to my teacher with multiple things in it, yes

pls guys can someone help me ?

Hello,

This is simple enough…

If you understand all the elements of the code you wrote in each of the sketches just combine them.

If it is not your must you should comment on source of the code.

Be sure to reference the forum when submitting the code to your teacher.

Some generic advice below:

Combine what is in the two setup() functions and do the same for the two draw() functions.

Where there a common elements you can comment them out or delete them.

Make sure the flow of code in setup() and draw() make sense and flows as required.

And voila!

:)