Fill and line not displaying (Help for a beginner)

Hi, my code is below :slight_smile:

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! :slight_smile:

Hi,

line() works with stroke(), not fill().

And since you said noStroke() a bit more up, it is not displaying anything !

That should works:

stroke(255, 153, 153);
line(50, 0, 50, height);

Thanks so much! I knew it would be something silly haha :slight_smile:

I’m a beginner myself, but I think you need to use stroke(), not fill(), to color a line. Hope this helps!