If Scratch were limited to the three variable attributes of
y position, and
direction that the interface provides, manipulating sprites on the screen would become boring very quickly. Anyone who has played a role-playing game (RPG) is familiar with a variety of attributes and skills typically available to characters. Because Scratch allows the creation of custom variables, we can create new attributes for our characters.
Your current Game of Tag program dictates how fast each character moves (e.g., 10 steps per movement). We could instead vary each sprite’s speed according to its “skill level.” In order to do that, let’s create a new variable called
In the Variables tab, click
Make a Variable, and enter
speed as the name. We will want each sprite in our program to have its own speed, so make sure that the button
For this sprite only is selected. Create one
speed variable for each character. What would happen if
For all sprites were selected? Experiment!
The Variables tab supplies two blocks to change the value of
Now that you know about
speed variables, make use of them for your Game of Tag program. For each
move  steps block, replace the numerical value
10 with the variable
speed by dragging it from the Variables tab into the slot.
For example, you should have something resembling the following:
Add the following functionality to your Game of Tag program:
- When the green flag is clicked, have each sprite ask for an initial speed. Set the
speedof each according to the
- When the second sprite is caught (e.g., when the cat touches the mouse, and the mouse says “OH NOs!!!”), increase the second sprite’s
- Pretend that the first sprite is a vertical kind of guy—whenever the first sprite moves up or down, increase his
1. Whenever he moves right or left, decrease his
- Make your
speedvariables visible on the screen so you can test your program to ensure it works correctly.
- Personalize your program in at least three other ways.
- Provide documentation for your program (describe what it does) as the Instructions. Be sure to describe how your program is original.
When you are satisfied with your work, submit a link to your program or the program itself. Your work will be reviewed by a peer, and in turn, you will review one of your peers’ projects. You should base your evaluation on the assignment rubric.
|Characters move properly||2 pts|
|Mouse says “OH NOs!!!” when characters touch||2 pts|
|Speed is determined by user input||2 pts|
|Mouse speed is conditioned on collisions with Cat||2 pts|
|Cat’s speed is conditioned on directional movement||2 pts|
|Displays speeds on the screen||1 pt|
|Documentation, usability, and personalization||1 pt|