Computer Science 2
Due Date: October 8, 2024
Moving Car on the Road
Original Program: (80 points)
Objective: Create a simple moving car animation on a road,
complete with additional elements like trees, clouds, and houses.
This code animates the car moving along
the road and allows it to stop at a traffic light.
Write a Python program using turtle.
Explanation:
- Road: A simple gray rectangle representing the road.
- Car: A red rectangle that moves along the road.
It stops briefly at a traffic light before continuing. - Traffic Light: The traffic light changes between red and green.
- Trees: Positioned along the road for added scenery.
- Clouds: White clouds floating in the sky.
- Houses: Simple houses along the roadside.
Modifications:.
Your part (20 points)
Requirement: Modify the traffic light to use Yellow.
Modify the light to place the Red, Yellow, and Green parts in a better position.
Make the car more realistic
Have the Car travel thru the light to the end of the road.
After traveling to the end of the road, start at the beginning on the left side.
Stop at the light each time the light is red.
Go when the light is green
Example of screen shot of output.
Click here to see a sample video of the output.
Code for the Program:
Running the Program
To run the program, use the following command:
python3 PX_MovingCar_lastname.py
Files to Submit
- PX_MovingCar_lastname.png (Screenshot of the program)
- PX_MovingCar_lastname (Google Drive document)
- PX_MovingCar_lastname.py (Actual Python program)
- PX_MovingCar_lastname.mp4 (Video of the program running)
Drop off your files into Google Classroom.