Hey, i would really appreciate some help with an assignement i have to do. I had to create this picture of a row of circles at the top and bottom. Each circle is connected with the others at the Bottom or Top. This is the code i have and it works, but i dont understand what i should add or change if i for example only want every third red and blue circle to connect?
int diameter = 25; //Size of circles
int y1 = 25;
int y2 = 475;
int spacing = 50; //Spacing between circles
int x1 = 25;
int x2 = 25;
void setup () {
size(500, 500);
}
void draw () {
background(255);
//Draw red circles at top and blue circles at bottom
for (x1 = 25; x1 < width; x1 += spacing) {
fill (255, 0, 0);
ellipse (x1, y1, diameter, diameter);
fill (0, 0, 255);
ellipse (x1, y2, diameter, diameter);
//Draw Lines between circles
for (x2 = 25; x2 < width; x2 +=spacing) {
line(x1, y1, x2, y2);
}
}
}
<