Hello guys,
I need help to make this code into mouse pressed or keypressed so I want that the code appears only if I press the mouse or a key as you want but if someone could help me it would be amazing !
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);
}
}
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();
}
}