AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Game building blocks

Week 24 · Unit 10: Be a game developer · 3 lessons
1

Plan a game

Computing 6: Unit 10, pp. 134–149
GoalBreak a game idea into elements and sprites, and write what each sprite must do.
New words
game element · a feature that makes a game work or fun, such as a goal, scoring, time, levels or a storysprite · a character or object in a Scratch projectdecomposition · breaking a big problem into smaller parts that are easier to solvecriteria · a list of things that a sprite or a program must do
Explanation

A game is much easier to build when it is planned first. Start with the big idea: who plays, and what is the goal? Games are made from elements such as a goal, scoring, time, levels, a story and competition. Next use decomposition and split the game into parts, with one part for each sprite. For every sprite write criteria, which say exactly what it must do. Then write an algorithm for each sprite, as a flowchart or as steps. Good games for a class are about catching, collecting, racing or dodging, not about hurting anyone. Build one sprite at a time and test it before you start the next.

SpriteIts job in ‘Sea clean-up’
Divermoves up and down with the arrow keys
Bottledrifts in from the right; the diver collects it to score a point
Timercounts down from 30 seconds; the game ends at 0
Worked examples
ElementIn ‘Sea clean-up’
goalcollect 10 bottles
scoring1 point for every bottle
time30 seconds on the clock
levelslevel 2: the bottles drift faster
storythe sea is dirty and the diver cleans it
Here are the five game elements for the ‘Sea clean-up’ game. Each one answers a different question about the game.
whenclickedsetscoreto0go to x:240y:pick random-150to150change x by-4changescoreby1go to x:240y:pick random-150to150iftouchingDiver?thengo to x:240y:pick random-150to150ifx position<-230thenforever
These are the criteria for the Bottle sprite, and the script that meets them. It starts at the right edge at a random height and drifts left. If the diver touches it, the score goes up by 1 and a new bottle appears on the right. A bottle that reaches the left edge also starts again on the right.
DiverBottleTimer
Decomposition gives each sprite its own small job. A big game is then a set of small programs that work together.
Class activity

Paper game plan (no computer): choose a game idea about catching, collecting, racing or dodging. Fill in a plan sheet with the five elements: goal, scoring, time, levels and story. Draw the stage on a large sheet and cut out three paper sprites. Write two criteria for each sprite on its back. A friend reads the criteria aloud while you move the paper sprites to play one round. Did the plan have a gap? If you have a computer or tablet, build the first sprite in Scratch and test it.

Practice
1
‘Bus dash’: the player drives a bus and collects passengers before a clock reaches zero. Each passenger scores 2 points. Name the goal, the scoring and the time element.
the player’s buspassenger: 2 pointsclock to zero
2
The plan for ‘Kite collector’ has one job missing. Write a good job for the Star sprite so that the game has a score.
SpriteJob
Kitemoves in four directions with the arrow keys
Star?
Cloudthe kite loses a life when it touches a cloud
3
Break a memory-quiz game into three parts. Say what each part does.
4
Why is it better to test each sprite when you build it, and not only at the end?