A Teacher’s Guide to Scratch: Lesson 9

August 25, 2015 by wendy

Scratch Quiz Game
bossness quiz by horse_lover7868 on Scratch

Have you noticed that games and apps often track information as you use them? This week, we’re diving into variables, which allow us to store and modify data within our programs.

Lesson 9: Keeping Score

Why, as computer programmers, do we want to store information? Do your students have any ideas? Brainstorm things that we want to track in our projects. For example, a game might want to store the player’s name, the number of lives left, or the number of coins collected. All of these things are kept as variables.

What is a variable?

A variable is like a jar. We can store anything inside of it and we can give it a label so that we know what’s inside. For instance, a variable called score can contain a number that represents how many points the player has earned.

Variables in Scratch

Scratch Variable Blocks
Variable blocks

Let’s see what a variable looks like in Scratch! Create a new Scratch project and under the “Scripts” tab, click on “Data”. From there, click on the “Make a Variable” button. Make up a label for the variable next to “Variable Name” and click “OK”.

Did your students notice all the new blocks that were created? Drag the circular block with the variable name into the scripts area. Click on it to demonstrate that we can use it to see its value similar to the answer block that we used for our quizzes last lesson. Drag out the remaining variable blocks and click on each one to demonstrate what they do.

Variables in action

Challenge your students to incorporate variables into an existing project. Maybe they can use variables to keep score in their quiz games from last lesson. Can they also think of ways to use variables in their mazes or design projects?

Project testing

The remainder of the lesson is time for your students to complete their design projects. For those who are finished, encourage them to find others to test their projects and fix any glitches or bugs that they might find.

A Teacher’s Guide to Scratch: Lesson 8

August 12, 2015 by wendy

Scratch Maze Game
A-maze-ing thing by THAT_GUY_YOU_HATE on Scratch

What makes a game? Is it characters? Is it story? Interactivity? In this week’s lesson, we explore common elements of games and how we can design and build our own games in Scratch.

Lesson 8: Dream Game

We’ve covered a lot of concepts over the last 7 lessons, including events, loops, timing, and messaging. All of them are important to making games, but today’s concept might be the most important.

Favourite games

In small groups, give your students a few minutes to brainstorm their favourite games and have each group choose one favourite game. Then come together as a class and create a list of favourite games. Discuss what these games have in common. What makes them games?

What are conditionals?

Almost all games have rules. Provide an example of a rule, like if the player touches a coin, then the player collects 5 points. See if your students can come up with a list of rules following the same sentence structure.

After listing a few examples, explain that in video games, these rules are called conditionals. A conditional starts with the word if followed by a condition, something that can be true or false. It ends with the word then, which is followed by an action, what to do if the condition is true. Revisit your list of rules. See if your students can identify the conditions and actions.

A special kind of conditional

There are different kinds of conditionals. The one we just covered is called if-then. There is another type of conditional called if-then-else. Can your students guess how it’s different?

If-then-else works just like if-then except it has an extra action after the word else that describes what to do if the condition is false. For example, if I’m feeling tired, then I’ll take a nap, else I’ll play outside. Can your students think of other if-then-else examples?

Maze or Quiz?

Maze Starter Project
Maze Starter Project

Quiz Starter Project
Quiz Starter Project

To gain more experience with conditionals, have your students remix a starter project that contains conditionals like our Maze Starter Project or Quiz Starter Project above. Each project has an example of how to use conditionals and a chance for students to try it themselves!

Project time

Once your students feel more comfortable with conditionals, encourage them to add conditionals to their design projects. At the end of the lesson, ask for a few volunteers to share how they incorporated conditionals into their projects.

A Teacher’s Guide to Scratch: Lesson 7

August 3, 2015 by wendy

Scratch Backdrop Project
cat and dog!!!!!!! by crazydog6000 on Scratch

In Lesson 6, we saw how we can use timing and messaging to synchronize sprites. This week, we continue to investigate how we can coordinate sprites with backdrops!

Lesson 7: The Stage

Why might it be useful to be able to coordinate the stage, or backdrops, with sprites? Can your students think of some examples?

What is the stage?

Suppose we want to add a start screen to one of our projects. Take, for example, the joke project that we made last week. We can remix the project so that when the start screen is clicked, the joke begins.

Show your students that they can add new backdrops by clicking on the Stage to the left of the Sprites area and selecting the Backdrops tab. The stage can have multiple backdrops just like sprites can have multiple costumes.

Click back to the Scripts tab. We can write code for the stage just like we can write code for sprites except that the stage has different code blocks. For example, the stage doesn’t have any motion blocks, but it does have looks blocks like “switch backdrop to…” and “next backdrop”.

Adding a start screen

Joke Project with Start Screen
Knock Knock Joke with Start Screen by marshmallowcoding on Scratch

Work together as a class or have your students work individually to add a start screen to an existing project. Choose any project or try our Knock Knock Joke with Start Screen project above that has notes for you to follow along! If your students worked individually, ask for a few volunteers to share their backdrops when they’re finished.

Polya’s problem solving tips

By adding timing, messaging, and backdrop changes, we’re adding a lot of complexity to our projects, which can also add glitches or bugs. Trying to fix these bugs can be frustrating. Here are some problem solving tips that you can share with your students:

  1. Understand the problem.
    • Can you explain the problem in your own words?
    • Can you draw a picture?
    • What do you already know?
    • What do you need to find out?

  2. Make a plan.
    • Have you solved a problem like this before?
    • Can you break the problem down into smaller pieces?
    • Is there something that you can test?

  3. Do it.
    • Carry out your plan.
    • Execute each step carefully.

  4. Check your work.
    • Did your solution fix the problem?
    • Could you have done it differently?
    • Can you use your solution to solve other problems?

Project time

For the rest of the class, your students can keep working on their design projects. Challenge them to incorporate multiple backdrops!