If I wanted to use an array to print out 50 smiley faces to the screen, how would I do it?
in
Programming Questions
•
5 months ago
Ive printed 3 smiley faces so far. How can I use arrays to print out 50 smiley faces to screen with the use of for loops? Here is where im at.
void setup ()
{
size(500,500);
smooth();
}
{
size(500,500);
smooth();
}
void draw()
{
background(200);
smileyface(100,250); //giving three smiley faces their coordinates
smileyface(225,250);
smileyface(350,250);
}
{
background(200);
smileyface(100,250); //giving three smiley faces their coordinates
smileyface(225,250);
smileyface(350,250);
}
void smileyface(int x, int y)
{
pushMatrix();
translate(x,y);
//stroke(0);
//strokeWeight(70);
ellipse(0,-35,120,-120); //the body
ellipse(-19.5,-65,30,30); //left eye
ellipse(19.5,-65,30,30); //right eye
arc(0,-30,40,40,0,HALF_PI); // smile
popMatrix();
}
{
pushMatrix();
translate(x,y);
//stroke(0);
//strokeWeight(70);
ellipse(0,-35,120,-120); //the body
ellipse(-19.5,-65,30,30); //left eye
ellipse(19.5,-65,30,30); //right eye
arc(0,-30,40,40,0,HALF_PI); // smile
popMatrix();
}
1