Where is addition hiding in Scratch score variables?
Make points increase and decrease so variables become visible number boxes.
Quick answer
In Scratch, addition is hiding in score variables when you use change blocks to add points to a variable. When your character scores points, the variable increases using addition. You can also use subtraction to decrease the score, which is like taking away points.
Learning outcome
By the end of this page, you will understand how addition works in Scratch when you change score variables and how to make your score go up and down using change variable by blocks.
- You can use the change variable by block to add or subtract points to your score
- You can see how variables change when you add or subtract numbers
- You can make a game where points increase or decrease using addition and subtraction
- You can explain how adding or subtracting numbers changes your score
Why this matters
Learning how addition works in Scratch helps you build games where your score changes. It's like magic – when you click a button, your points go up or down! Understanding this makes you a better game designer and helps you see how maths works in fun digital worlds. This skill also helps you in real life, like when you're adding up your pocket money or counting points in a game.
How it works
Scratch uses variables to store numbers, like a box that holds a score. When you want to add points, you use the change variable by block. This block takes the current number in the variable and adds or subtracts a new number to it.
- First, you create a variable called Score
- Then, you use the change variable by block to add points
- For example, if your score is 10 and you add 5, it becomes 15
- You can also subtract points using negative numbers
Examples you can see
Imagine you're playing a game where you collect stars. Your score starts at 0.
| What happens | Current Score | Change | New Score |
|---|---|---|---|
| Start game | 0 | + 0 | 0 |
| Collect 1 star | 0 | + 1 | 1 |
| Collect 3 stars | 1 | + 3 | 4 |
| Collect 2 stars | 4 | + 2 | 6 |
| Lose 1 point | 6 | - 1 | 5 |
You can see how the score grows and shrinks. This is like adding or taking away blocks in a tower!
Try it as a mini adventure
Adventure: Build a Star Collector Game
You are a game designer creating a game where you collect stars. You must make a character that collects stars and adds points to the score.
- Start a new Scratch project
- Create a variable called Score
- Set the score to 0 at the start
- When the character touches a star, use change variable by 1
- Try changing the number to 5 or 10 to see how it changes
- Make a second event that subtracts points when the character touches a cloud
Now your game has addition and subtraction hiding in the score variable!
Common mistakes
- Mistake: Using set variable to instead of change variable by
Why it happens: You think you're adding points, but you're replacing the score completely.
Fix: Use change variable by to add or subtract points, not replace them. - Mistake: Forgetting to set the score to 0 at the start
Why it happens: The variable might have a random number from before.
Fix: Use set variable to 0 at the start of your game. - Mistake: Using the wrong variable name
Why it happens: You type Score but the variable is called Points.
Fix: Check your variable name carefully. Make sure it matches exactly. - Mistake: Adding a negative number by mistake
Why it happens: You forget that adding a negative number means subtracting.
Fix: Use change variable by -1 to subtract points, or use change variable by 1 to add points.
Parent and carer guide
Help your child understand how addition works in Scratch by playing a simple game together. Start with a variable called Score and use the change variable by block to add points. Ask your child to predict what happens when they add 5 points to 10 points. Encourage them to try different numbers and explain their thinking. If they make a mistake, help them find the correct block. It's okay if they don't get it right the first time – that's how you learn!
Try these questions to check understanding:
- What happens when you change the variable by 3?
- What happens when you change the variable by -1?
- How can you make your score go up?
- How can you make your score go down?
Practice questions
- What does the change variable by block do?
- If your score is 15 and you change it by 5, what is the new score?
- If your score is 20 and you change it by -3, what is the new score?
- What happens if you change a variable by 0?
- Why do we use change variable by instead of set variable to for adding points?
Answers:
- It adds or subtracts a number to the current value of the variable
- 20
- 17
- It stays the same
- Because set variable to replaces the number, but change variable by adds or subtracts from it
FAQ
What is a variable in Scratch?
A variable is like a box that holds a number. You can change the number inside the box as your game runs.
How do I make a variable in Scratch?
Click the Variables category in the block palette. Then click Create a Variable and name it something like Score.
What does change variable by do?
It takes the current number in the variable and adds or subtracts a new number to it. For example, if the score is 10 and you change by 3, it becomes 13.
Can I use negative numbers with change variable by?
Yes! Using a negative number like -5 will subtract points from your score.
Why can't I just use set variable to?
Because set variable to replaces the number completely. Change variable by adds or subtracts from the current number, which is what you need for scoring.