Mar 092017
- Log into scratch and start a new program
- Create a new sprite and draw a simple traffic light
- Duplicate the costume and fill in the lights in the correct sequence (as discussed in class)
- Program your traffic lights
- Get a car sprite and get it move left and right on your screen (you will need the if on edgebounce block)
- Click the left-right arrow in the sprite settings (so it doesn’t go upside down when going left)
- Can you change the car script so that it only moves when the traffic lights are green?
- Make a new variable (in data blocks) called “lights”
- In the traffic light code, make it change “lights” to “green”, “green+amber”, “red”, “amber”
- Make the car move only when lights are green (forever, if, lights = green, move)
- Get the Scratch cat to walk across the road, when the lights are on red.
- Use this crash code to stop the game if there is a crash:
- Can you add a pedestrian crossing button (a new sprite) so that when you press it, it turns the lights red?