Year 5 (ages 9–10, Grade 4 in the US) · Computing · Selection · Lesson 3
Selection in games
Using selection with sensing conditions (key pressed, touching, touching colour) inside forever loops to build and debug a simple collecting game.
Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

14-minute video lesson
Teaching, worked examples and 20 practice questions solved step by step.
Watch free for a monthWhat your child will learn
- Use sensing conditions
- Combine if with forever
- Use a score variable
- Debug game rules
The method
- Rule.
- Sensing.
- In forever.
- Test.
Key words: sensing, selection, forever, variable, touching, debug.
Worked examples
Worked examples from the lesson, with every step.
Question 1
Which condition checks if a key is pressed?
- Step 1: key pressed?
Answer: key ___ pressed?
Question 2
Which condition checks if two sprites meet?
- Step 1: touching
Answer: touching ___ ?
Question 3
In the game, what moves the player right?
- Step 1: right arrow
Answer: pressing the right arrow (change x by 10)