Hi ! I’ve been teaching myself Processing with online resources and the Learning Processing book for a couple of months now. It’s so I can execute a project I’m working on.
But I can’t seem to find a way to do this seemingly simple thing. This is not the project but some code I’m practicing on…
float x = 100;
float y = 100;
float s = 50;
float fcol = 150;
void setup() {
size(1000, 500);
background(255);
drawflower(x, y, 50, 0);
drawflower(x, y, 20, 50);
drawflower(x, y, 80, 100);
drawflower(x, y, 100, 150);
drawflower(x, y, 30, 200);
drawflower(x, y, 60, 250);
}
void drawflower(float x, float y, float s, float fcol) {
ellipseMode(CENTER);
fill(fcol);
ellipse(x, y, s, s);
stroke(0);
line(x, y+s/2, x, height);
}
ISSUE: I want the x and of the flower to increment by say, 50, each drawflower object with its unique size and colour to appear in a new position and form a line.
I haven’t been able to figure out how to do this. I’ve tried WHILE loops and FOR loops, and am learning now about arrays but don’t know enough to apply it yet. When I use a while or for loop it only repeats the first flower.
I don’t even know if this is an easy fix. Can someone enlighten me a bit please?