Lesson 7: You’ve got the moves!
Year 7 – Programming essentials in Scratch: part II
Think, write, pair, share
Starter activity
What do you think might happen when this code is run?
Custom blocks are subroutines
Starter activity
Subroutines are a group of instructions that will run when called by the main program or other subroutines.
Subroutines allow us to use a piece of code again and again whenever we call them.
Lesson 7: You’ve got the moves!
Objectives
In this lesson, you will:
4
Four volunteers please!
Activity 1
Subroutines and decomposition
Activity 1
Subroutines can be called whenever you need them, and in any order you want.
Once a subroutine is written and working, the instructions inside become less important.
Subroutines help break down a problem into small manageable chunks. This in known as decomposition.
Problem
Activity 2
A programmer wants to create a character that will perform different dance moves to a song. The dance moves will form part of a dance battle game where players perform the best moves to earn points.
Problem
Activity 2
A programmer wants to create a character that will perform different dance moves to a song. The dance moves will form part of a dance battle game where players perform the best moves to earn points.
Think, pair, write, share
How could the programmer decompose this problem?
Plan four moves
Activity 3
Some decomposition has been started for you.
The programmer would like to have four different dance moves and wants a subroutine for each one.
Use the worksheet to design four moves for your character to perform.
The worksheet shows the nine different costumes that you can use.
How to create your own subroutines
Activity 4
Your teacher will demonstrate how to create your own subroutines in Scratch.
Create four subroutines
Activity 4
Use this Scratch project to create four dance moves.
Two example moves have been given to Jordyn already to help you.
You can delete or keep these moves.
Explorer task
Create more complex moves and check that your moves match the beat of the music.
ncce.io/DanceBattle
Extending your game
Activity 5
Trigger the moves based on a key press.
You can add more than one move to a key press.
Copy the subroutines over to your other character and modify the key presses.
Explorer task
Add a scoring system for the different moves of each character. Work out who wins!
What do you know about subroutines?
Plenary
Write one thing that you know about subroutines on a sticky note and attach it to the whiteboard.
Next lesson
Summary
In this lesson, you…
Next lesson, you will…
14