How to change color of shapes
in
Programming Questions
•
6 months ago
I am in dire need of help with my code. I want to change the color of my creations shoes and mustache but I'm not sure how to at this point. I am fairly new to Processing so I don't know how to. Thanks! Here is the code I have so far.
- }void setup(){
size(1025, 600);
}
void draw() {
background(255);
for (int x = 35; x < width +240; x += 240) {
superhero(x, 110);
}
}
void superhero(int x, int y) {
int d = 80;
int f = 15;
//tried to do a loop for y but it wouldn't accept it
//hair
pushMatrix();
translate(x, y);
fill(102, 51, 0);
rect(100, 100, 110, f);
rect(80, 115, d, f);
rect(80, 130, d, f);
rect(55, 145, d, f);
rect(55, 160, d, f);
rect(55, 175, d, f);
rect(55, 190, d, f);
rect(100, 205, 60, f);
rect(100, 220, 60, f);
//face
fill(255, 204, 153);
rect(160, 115, 60, f);
fill(255, 204, 153);
rect(160, 130, 40, f);
fill(255, 204, 153);
rect(135, 145, 25, f);
rect(135, 160, 25, f);
rect(135, 175, 45, f);
rect(135, 190, 65, f);
fill(255, 204, 153);
rect(225, 175, 35, f);
rect(160, 190, 40, f);
rect(160, 205, 70, f);
rect(160, 220, 70, f);
//hair
fill(102, 51, 0);
rect(200, 115, 35, f);
fill(102, 51, 0);
rect(200, 130, 35, f);
//mask
fill(102, 204, 0);
rect(160, 145, 60, f);
rect(160, 160, 90, f);
rect(180, 175, 65, f);
//mustache
fill(153, 76, 0);
rect(200, 190, 45, f);
//suit
fill(102, 204, 0);
rect(80, 235, 120, f);
rect(110, 250, 120, f);
rect(110, 265, 100, f);
rect(110, 280, 100, f);
rect(110, 295, 100, f);
rect(110, 310, 100, f);
rect(140, 325, 40, f);
//left arm
fill(0);
rect(60, 250, 50, f);
rect(40, 265, 70, f);
rect(40, 280, 50, f);
//right arm
rect(230, 250, 15, f);
rect(210, 265, 55, f);
rect(230, 280, 35, f);
//legs
fill(0);
rect(90, 325, 50, f);
rect(180, 325, 50, f);
rect(70, 340, 50, f);
rect(200, 340, 50, f);
//shoes
fill(102, 204, 0);
rect(50, 355, 70, f);
rect(200, 355, 70, f);
//hands
fill(192, 192, 192);
rect(40, 295, 70, f);
rect(40, 310, 50, f);
rect(210, 295, 55, f);
rect(225, 310, 40, f);
popMatrix();
}
1