2. Starter
1. Load Scratch
2. Make a game that
will make a sprite
change colour
when it touches
another sprite
2
3. Objective of the lesson
Use a variable
• All of you will:
– Create a variable that changes its value when a sprite is
clicked
• Most of you will:
– Set a variable’s starting value and count up and down with
variables
• Some of you will:
– Create a working game that keeps score and has a time limit
3
5. How much do you remember?
1. When does the script run?
2. Where would you find the option
to change the colour of the sprite?
3. Where would you find the “Go to
X and Y” option?
4. Where would you find the random
option?
5
6. Over to you…
• Change the background and add a
sprite of your choice.
• Add the script as shown below.
6
8. How much do you remember?
1. What is a variable?
2. How can you make a new
variable?
3. How can I change the value of my
variable?
4. When do you want the variable to
start from 0 again?
5. How can you set the variable to 0?
8
9. Use a variable
• Make a variable called Score.
• Change the script so that when your
sprite is clicked it will add one to the
score.
• Change the script so that when the green
flag is clicked the score will be set to 0.
• Try out your game.
9
10. Over to you…
• Make your own game which has two sprites.
• Make one follow your pointer and the other
move around the screen
on its own.
• When one sprite touches
the other, change the
score and then move to
another part of the screen.
• Try out different ideas
to make your game more interesting and
exciting to play.
10
11. Counting down
• What will this code do?
• Add this code to your
game to make a time
limit so that after 60
seconds the game will
stop.
• The “=” can be found
in
11
12. Look at other peoples’ games
Have a look the games that your
classmates have created.
1. What do you like about them?
2. What did people do that was different
to your game?
3. If you got stuck, what did you
do to help yourself solve the
problem?
12
13. What skills have you practiced today?
New skills you have learnt today…
13
Revisit skills from another lesson…