Return to site

Build a Road Game in Scratch

Educators & parents: You can do this Hour of Code Activity as a class or students can work on it independently. If you have any questions or need help, email info@codespeaklabs.com.

Computer science has a critical role to play even in areas where there is no computer to be seen! For example, coding can help with infrastructure planning. 

"Infra... what?" you might be thinking.

Infrastructure is the term used to describe the structures and facilities which support modern human life.

Think of things like roads, sewage, bridges, mass transit, and telecommunications networks.

In today’s project, we are going to build roads! Roads are a really important part of infrastructure. Roads give us safe and convenient ways to get to where we need to go, whether it's a friend's house, school, the hospital, or the airport.

Planning roads is a complex task. Civil engineers use computers to plan out roads that are effective and efficient.

That’s what today’s project is about. This is a game called Build a Road. In the game you build, the user will play the role of a civil engineer to make a road that is

  1. Effective - making sure the road connects point A to point B, AND
  2. Efficient - keeping the road as short as possible, using the least amount of resources as possible. 

Each time you click, you will get a piece of road to place on the screen. You can’t just place roads anywhere; you must connect the previous road you placed. 

Each time you place a road, the number of clicks go up. How many clicks does it take to connect point A to point B? The less clicks, the more efficient your road will be. 

Ok, let’s get coding! 

Watch the videos below to get started, and follow along with me to build your own Road Game.

Part 1: How do we play?

Part 2: Let's start building the road

Part 3: Adding Game Rules

Bonus: Win and lose screens

Play the completed game below!

Want to go beyond Hour of Code and learn more about painting your own sprites in Scratch? 

Check out this tutorial on how to paint your own Sprites. Or, if you want to become a faster Scratch coder, learn how to reuse code and sprites by learning how to use the backpack.

If you had fun, check out our YouTube channel for more free coding projects like these! Go to youtube.com/codespeaklabs