Create repetition :)

After watching the video, I tried to put draw the face in a new function, as a separate layer, so I can duplicate and move the location of the face.

But then I realized that my x,y location is related to the coordination of the face, so the face is scaling up and down when I change the coordination of the smiley face in the draw() function.

Screen Shot 2021-09-29 at 9.16.53 PM.png

With help from my classmates, I added the function translate() in my code and then change the coordination of the eyes and mouth to a number instead of x,y, it finally works! But I still did not figure out how to draw the face in a loop without using for() or while() function.

Hope you all like it!

↳Here is the link

Previous
Previous

Reorganizing the code

Next
Next

Turn the light on