Beginner Program
in
Programming Questions
•
1 year ago
Hi everyone.
I am attempting to write a program that will draw different coloured filled circles in all four quadrants. That is the top left quadrant to draw red circles, the bottom left quadrant to draw green circles and the other two quadrants blue and black. I am an absalute beginner and I know the code I have so far is terrible and totally wrong but I can't seem to get the outcome Im looking for.
Absolutely any help in would be very appreciated in what or where it is Im going wrong.
Thanks.
int x = width/2;
int y = height/2;
int y = height/2;
void setup() {
size(600,400);
background(255);
smooth();
noStroke();
ellipseMode(CENTER);
}
size(600,400);
background(255);
smooth();
noStroke();
ellipseMode(CENTER);
}
void draw() {
if (mouseX < x && mouseY < y && mousePressed) {
fill (255,0,0);
ellipse(mouseX, mouseY, 20,20);
if (mouseX > x && mouseY > y && mousePressed) {
fill (0,255,0);
ellipse(mouseX, mouseY, 20,20);
if (mouseX < x && mouseY > y && mousePressed) {
fill (0,0,255);
ellipse(mouseX, mouseY, 20,20);
if (mouseX > x && mouseY > y && mousePressed) {
fill (0);
ellipse(mouseX, mouseY, 20,20);
}
}
}
}
}
void mousePressed() {
ellipse(mouseX, mouseY, 20,20);
}
if (mouseX < x && mouseY < y && mousePressed) {
fill (255,0,0);
ellipse(mouseX, mouseY, 20,20);
if (mouseX > x && mouseY > y && mousePressed) {
fill (0,255,0);
ellipse(mouseX, mouseY, 20,20);
if (mouseX < x && mouseY > y && mousePressed) {
fill (0,0,255);
ellipse(mouseX, mouseY, 20,20);
if (mouseX > x && mouseY > y && mousePressed) {
fill (0);
ellipse(mouseX, mouseY, 20,20);
}
}
}
}
}
void mousePressed() {
ellipse(mouseX, mouseY, 20,20);
}
1