I am a total beginner but I was working on this project and I have some questions. After fiddling around with the code I got it do what I want but I’m unsure why it works. I commented out the two sections I am having trouble grasping any help would be awesome.
var xPositions = [200];
var yPositions = [0];
var bottom=[200];
var change=[0];
draw = function() {
background(204, 247, 255);
for (var i = 0; i < xPositions.length; i++) {
noStroke();
fill(0, 200, 255);
ellipse(xPositions[i], yPositions[i], 10, 10);
yPositions[i] += 5;
ellipse(xPositions[i], bottom[i], 10, 10);
bottom[i]-=5;
if (bottom[i] > 50 && bottom[i]===yPositions[i]){
strokeWeight(4);
fill(255, 0, 0);
ellipse(200,150,500,50);
}
for (var x=0;x<change.length;x++){
fill(255, 0, 0);
ellipse(0,change[x],50,50);
change[x]+=5; //why does the var have to be an array to get the drops to fall (x) x=-5 doesn’t work
if (change[x] >=400 ){
fill(255, 0, 0);
ellipse(0,change[x],50,50);
change[x]-=500; //why does this not work if the value is only -=5? that is repeat over and over it just stops
}
}//x child for looop end
} //parent for loop end