im new to coding and i cant quite figure it out. any sort of help would be awesome!
int [] x = new int [1000];
float [] y = new float [1000];
float [] speed = new float [1000];
float [] size = new float [1000];
int shift = 15;
int start = 0;
PImage pic;
boolean click = false;
void setup(){
size (1200, 800);
surface.setResizable (true);
noStroke ();
import processing.sound.*;
SoundFile file;
file = new SoundFile(this, "rain-03.mp3");
file.play();
pic = loadImage ("treepic.jpg");
for (int i = 0; i < x.length; i++){
x [i] = i * shift;
y [i] = random (start - 10, start + 10);
speed [i] = random (1, 30);
size [i] = random (5, 10);
}
}
void draw(){
pic.resize(width, height);
image (pic, 0, 0);
//fill (200);
rainDrop();
for(int i = 0; i < x.length; i++){
y [i] = y [i] + speed [i];
if (y [i] > height){
y [i] = random (start - 10, start + 10);
}
}
}
void rainDrop(){
fill(200);
for(int i = 0; i < x.length; i++){
arc (x [i], y [i], size [i], size [i], 0, PI);
triangle (x[i] - size [i]/2, y[i], x[i], y[i] - size[i], x[i] + size[i]/2, y[i]);
}
}
void mouseClicked(){
if (!click){
for (int i = 0; i < x.length; i++){
speed [i] = 0;
}
click = true;
} else if (click){
for(int i = 0; i < x.length; i++){
speed [i] = size [i];
}
click = false;
}
}