Thats basically the Same like with adding one ball. Just for multiple times. Now there are 2 ways. Either just do this 10 times with a for (int i = 0 ; i < howManyNewBalls; i++) around the whole thing. Or you change the code a bit for more efficiency.
void mousePressed() {
if ( mouseButton == LEFT ) {
if (!firstMousePress) {
for (int i=0; i < bola.length; i++) {
strokeWeight(2);
warna = color(random(255), random(255), random(255));
bola[i] = new Benda(mouseX, mouseY, random(30), warna);
}
firstMousePress = true;
} else {
Benda[] bolaTemp = new Benda[bola.length + 10];
for (int i = 0; i < bola.length; i++) {
bolaTemp[i] = bola[i];
}
for (int i = 0; i < 10; i++) {
bolaTemp[bolaTemp.length-(i+1)] = new Benda(mouseX, mouseY, random(30), warna);
}
bola = bolaTemp;
}
}
}