Need help adjusting code
in
Programming Questions
•
1 year ago
Ok, I got this rain generator but I'm trying to figure out how to get it to drop less drops while falling at a slower rate AND keeping the drop distance at 600. Can someone help?
- import processing.opengl.*;
- int[] rainX = new int[20];
- int[] rainY = new int[20];
- int rainZ = 600;
- void setup() {
- size(600, 400, OPENGL);
- noStroke();
- noCursor();
- camera(width/2, 400, 560,
- width/2, height/2, 200,
- 0, 1, 0);
- }
- void draw() {
- background(255);
- fill(0);
- rect(0, 0, 600, 400);
- for (int i = rainX.length-1; i > 0; i--) {
- rainX[i] = rainX[i-1];
- rainY[i] = rainY[i-1];
- }
- rainX[0] = (int)random(mouseX-50, mouseX+50);
- rainY[0] = (int)random(mouseY-50, mouseY+50);
- sphereDetail(6);
- fill(70, 130, 180);
- for (int c = 0; c < rainX.length; c++) {
- pushMatrix();
- translate(rainX[c], rainY[c], rainZ);
- sphere(6);
- popMatrix();
- rainZ -= 30;
- }
- rainZ = 600;
- }
1