CODEHS Graphics Stop Light Write a program that draws a stoplight. You should have a gray rectangle,
No answer yet for this question.
Ask a Tutor
Question:
CODEHS Graphics Stop Light
Write a program that draws a stoplight. You should have a gray rectangle, and then three circles in the rectangle. The circles should be red, then yellow, then green.
The rectangle should be centered on the screen. The yellow light should be centered on the screen, and the red and green light should be offset by BUFFER amount. BUFFER amount represents the distance from the center of one circle to the center of another circle.
Implement the function draw_circle that draws a single circle. Use it to draw the red, yellow, and green lights. Since all of the lights are the same size and aligned vertically, the function only needs to take the y position and color as arguments.
Posted Date: