top of page
Search

🚦🟥🟨🟩Code the Lights! Create a Realistic Traffic Signal System in Scratch – Perfect for Kids & Beginners!

Create a working traffic light system that changes from red ➝ yellow ➝ green, with a car sprite that moves only when the light is green.



🧩 Step-by-Step Instructions


Step 1: Set the Scene


  • Click on Choose a Backdrop, then select the colour full city backdrop.(you can select any backdrop as your wish)

  • Delete the cat sprite.

  • Click on Choose a Sprite and add the car sprite to your project.

  • Create new circle sprite with colours 🟥🟨🟩

  • Create a line sprite

Programming interface with coding blocks on the left and a colorful city backdrop on the right. A green convertible is on the road.

Step 2: Add Variables


  • Go to Variables → Make a Variable → Name it: canMove

  • This will control whether the car can move or not.


when green flag clicked
forever
  // RED Light
  set [canMove v] to [no]
  switch costume to [red v]
  wait (3) seconds
  // GREEN Light
  set [canMove v] to [yes]
  switch costume to [green v]
  wait (3) seconds
  // YELLOW Light
  set [canMove v] to [no]
  switch costume to [yellow v]
  wait (1) second
end
Scratch interface showing coding blocks on left, a green car on a city street scene with colorful buildings and traffic light on right.

✅ Final Test


Click the green flag and when green shows the car moves ,when red and yellow shows the car stops.


🚦💬 “From red to green, you've just coded the traffic scene! You're not just learning to code — you're coding to learn! Keep going, young programmer — the world runs on logic, and now, so can your imagination!”

 
 
 

Comments


Logicbox Innovation Pvt Ltd

Kariyad Airport Road,

Near Cochin International Airport, Nedumbassery, Ernakulam,

Kerala, India - 683589

support@logicbox.ac

+91 7559999090

©2025 by Logicbox. 

  • YouTube
  • Instagram
  • Facebook
  • LinkedIn
bottom of page