int num = 500; float[] posX = new float[num];//new array that stands for x position of every possible raindrop float[] posY = new float[num];//new array that stands for y position of every possible raindrop float[] speedX = new float[num];//new array that stands for left-right speed of every raindrop float[] speedY = new float[num];//new array that stands for up-down speed of every raindrop float[] dropFall = new float[num];// '' '' stands for drop rate of each raindrop float[] dropWidth = new float [num]; // '' '' stands for width of every created raindrop float[] dropHeight = new float [num]; // '' '' stands for height of every created raindrop float[] dropFill = new float [num]; // '' '' stands for opacity of created raindrop boolean[] click = new boolean[num];//new array that adds "true" every time mouse is clicked int counter = 1;//sets an integer variable to add to every time the mouse is pressed int thundercounter = 0; int thunder = 0; int lightning = 0; int shake = 0; float y; //sound library load import krister.Ess.*; //creating new audio channels for each sound to be used in the program AudioChannel myChannel; AudioChannel myChannel1; AudioChannel myChannel2; AudioChannel myChannel3; AudioChannel myChannel4; AudioChannel myChannel5; AudioChannel myChannel6; AudioChannel myChannel7; AudioChannel myChannel8; AudioChannel myChannel9; AudioChannel myChannel10; AudioChannel myChannel11; //creating placeholders for the picture files to be used in the program PImage a; PImage b; void setup() { frameRate(60); size (600, 400);//sets size of viewing window to 600 pixels wide & 400 pixels tall background (0, 0, 255);//sets background color to blue a = loadImage("Vectoraindrop.gif");//loads the picture to be used for the raindrops b = loadImage("AD305_Assignment1_Background.jpg");//loads the background image for the program image (b, 0, 0);//displays the background image noStroke (); smooth ();//removes jagged edges from the raindrops fill (51, 160, 255); //sets raindrop color to aqua for (int i = 0; i= 10) { if (thunder >= 0 && thunder <= 10){ thunder = thunder + 1; tint (lightning, 0, 0); image (b, 0, 0); if (thunder >= 6 && thunder <= 8) { tint (lightning, 0, 0); image (b, 0, 0); } if (thunder >= 10){ thunder = 0; thundercounter = 0; } } } for (int i = 0; i 30) { speedY[counter-1] = 5; } if (abs(posX[i]-(mouseX-dropWidth[counter])) <= 10 && abs(posY[i]-(mouseY-dropWidth[counter])) <= 10){ if (mousePressed == true){ dropWidth[i] += 1; //adds to the radius of the circle as the mouse button is pressed if (dropWidth[i] > 30){ speedY[i] = 5; } } } if (speedY[counter-1]==5 && (abs(posY[counter-1]-posY[i])<10) && (abs(posX[counter-1]-posX[i])<30)){ if (posX[counter-1]-posX[i] < -10){ speedY[i]=0; } if (posX[counter-1]-posX[i] < 0 && posX[counter-1]-posX[i]> -10){ speedY[i]=5; } if (posX[counter-1]-posX[i] > 0 && posX[counter-1]-posX[i]< 10){ posX[i]=posX[i]+15; speedY[i]=5; } if (posX[counter-1]-posX[i] > -20 && posX[counter-1]-posX[i] < -40){ posX[i]=posX[i]-10; speedY[i]=5; } if (posX[counter-1]-posX[i] < -10 && posX[counter-1]-posX[i]> -30){ posX[i]=posX[i]-5; speedY[i]=5; } } } } void mousePressed () { //start the sound if (mouseX < 60){ myChannel1.play(1); } if (mouseX > 60 && mouseX < 120){ myChannel2.play(1); } if (mouseX > 120 && mouseX < 180){ myChannel3.play(1); } if (mouseX > 180 && mouseX < 240){ myChannel4.play(1); } if (mouseX > 240 && mouseX < 300){ myChannel5.play(1); } if (mouseX > 300 && mouseX < 360){ myChannel6.play(1); } if (mouseX > 360 && mouseX < 420){ myChannel7.play(1); } if (mouseX > 420 && mouseX < 480){ myChannel8.play(1); } if (mouseX > 480 && mouseX < 540){ myChannel9.play(1); } if (mouseX > 540 && mouseX < 600){ myChannel10.play(1); } dropWidth[counter] = random (6, 12); posX[counter] = mouseX-dropWidth[counter];//sets the position of specified raindrop to the x co-ordinate of mouse posY[counter] = mouseY-dropWidth[counter];//sets the position of specified raindrop to the y co-ordinate of mouse if (thundercounter<=10){ thundercounter++; if (thundercounter == 10) { myChannel11.play(1); } }else{ thundercounter = 0; } counter++;//adds one to the variable "counter" every time the mouse button is pressed println(thundercounter); } public void stop() { Ess.stop(); super.stop(); }