Tutorpip← About this lessonOpen the sheet →Download PDF
Ages 10+ · Coding · Build a project
A larger game
Split intopartsMake each partworkJoin one at atimeCheck as you go
A big game from small parts.
The big ideaBuild a big program from small parts. Make each work, then join them.

How it works

A big program is built from small parts, the way a jigsaw puzzle is built a piece at a time.

Make each part work alone first, and then join them, one at a time, checking after every join.

Give every box a clear name. Two boxes with the same name clash and share one number.

Reuse a part instead of copying it. A custom block is written once and used anywhere, so changing it once changes every use.

The ship• moves with the arrow keys• stays on the screenThe rocks• fall from a random spot• get faster each level
The three parts of Teo and Mina's game.

Example 1: Split it up

  1. Teo and Mina want a game with ships, rocks, hearts, shields, bosses and ten levels.
  2. That is too big to build at once, so they split it into three parts: the ship, the rocks and the hearts.
  3. Mina builds the ship and Teo builds the rocks, and each part gets its own screen.

Example 2: A name clash

  1. When they join the parts, the ship zooms about while the rocks creep.
  2. Both parts had a box called speed, so they shared one number.
  3. The mix-up to fix: rename them ship speed and rock speed.

Example 3: Reuse a part

  1. Teo copied his rock code five times, so changing the size needs five fixes.
  2. A custom block called make a rock is written once.
  3. Change the block once, and every rock changes.

Example 4: Join and check

  1. Join the ship and the rocks, and check that it works.
  2. Then join the hearts, and check again.
  3. A bug found after one join is easy to find, because only one thing changed.

Words to know

part
A small piece of a big program that works alone.
custom block
A block you write once and use anywhere.
clear name
A name that says what the box holds, like ship speed.

Watch out

Try it

  1. Should a giant game be built in one big piece or in small parts?
  2. Both the ship and the rocks have a box called speed. What goes wrong?
  3. Which names fix it: speed and speed, or ship speed and rock speed?
  4. Why use a custom block instead of copying code five times?
  5. Which part shows how many lives are left?
Answers: 1. In small parts · 2. They share one number · 3. ship speed and rock speed · 4. Changing it once changes every use · 5. The hearts
Try at homeChoose a big job at home, like tidying a room or planning a picnic. With a grown-up, write it as three or four small parts. Give each part a clear name, and do them one at a time. Notice which part took longest.
For grown-upsTry the Mission on a real job at home, like tidying a room or planning a picnic: write it as three or four small parts, give each a clear name, do them one at a time, and notice which took longest.
Open these notes on screenScan the code, or go to tutorpip.com.