Fill all ellipse up above the diagonal.
in
Programming Questions
•
7 months ago
Hi everybody, i'm pretty new with processing and i really love it but i've some problems S:.
I've to do an excercise that my university teacher gave to me but i cna't pass trought this thing. Essentially, if you look at the screen, i've to fill all the ellipse above the diagonal with a green color and all ellipse below, with a red color.
Now this is what i did:
I've to do an excercise that my university teacher gave to me but i cna't pass trought this thing. Essentially, if you look at the screen, i've to fill all the ellipse above the diagonal with a green color and all ellipse below, with a red color.
Now this is what i did:
- void setup()
{
size(350, 450);
background(253, 212, 145);
line(30, 400, 30, 50);
line(30, 400, 300, 400);
line(30, 400, 300, 30);
}
void draw() {
int[] posX = {220, 150, 120, 110, 60, 80, 200, 240, 170, 220, 120, 140, 130, 160, 210, 210};
int[] posY = {350, 180, 220, 320, 280, 200, 310, 290, 130, 240, 280, 260, 340, 320, 200, 270};
int[] dimensione = {43, 42, 49, 18, 24, 32, 310, 36, 52, 55, 36, 48, 48, 26, 26, 58, 22};
int count= posX.length;
for(int i=0; i<=15;i++){
ellipse(posX[i],posY[i],dimensione[i]/2,dimensione[i]/2);
if(posY[i] > HERE I PUT A VALUE){
fill(255,155,123);
}
else{
fill(111,144,113);
}
}
}
Now i tried to put inside the posY[] a value that goes around 100 and 300 but it works bad... i know is not the correct way to do this thing but i tried.
p.s= i know just arrays, variable and for/while/if etc.. so i've to do this with those features. Anyone have an advice??? thanks so much.
p.s= i know just arrays, variable and for/while/if etc.. so i've to do this with those features. Anyone have an advice??? thanks so much.
1