Hi, my code is below
Water drop;
Water [] drops = new Water[300];
void setup() {
size(600, 400);
for (int i = 0; i < drops.length; i++) {
drops[i] = new Water();
}
}
void draw() {
background(255);
noStroke();
fill(0);
ellipse(width/2, 0, 100, 20);
for (int i = 0; i < drops.length; i++) {
drops[i].display();
drops[i].fall();
}
fill(255, 153, 153);
line(50, 0, 50, height);
}
class Water {
float x;
float y;
float ySpeed;
Water() {
x = random(255, 345);
y = 12;
ySpeed = random(4, 7);
}
void display() {
fill(0, 0, 200);
rect(x, y, 3, 3);
}
void fall() {
y = y + ySpeed;
if (y > height) {
y = 12;
}
}
}
It works just fine, but I have a two lines of code at the end of draw (line() and fill()) which arenโt displaying, can someone explain to me why?
Also, if anyone has any comments on my code, good or bad, Iโd greatly appreciate!
Thanks in advance!