Variables allow you to save data values in Scratch. You can save a player's score in a game, a user's name, or just about any text or numeric data that you would need to develop your Scratch projects. In this movie, see what variables are and how to use the Variables scripts in Scratch to add variables to your Scratch creations. Also see how to use and modify your variables' values.
- [Voiceover] Variables allow you to save certain values…so that you can recycle those values…or keep track of them later on.…Think of a variable like a user's score in a game.…It's a saved number value…that goes up when the user gains points.…That's how variables work in code.…And that's the basics of how a variable works…in Scratch.…So let's go over to the Data section…and this is where you're going to find the option…to create a variable.…
And you can think of a variable…as one of these rounded values…that you can put somewhere else.…So I'm going to click Make a Variable.…And you can make your variable for all sprites…or for this sprite only.…I'm going to choose for all sprites…and I'm going to name this rightEdge.…Then I'll click OK.…And what this variable is going to represent…is the right edge of the screen.…So let's say I had other sprites…that I was shooting.…
Imagine the wizard shooting lightning bolts…and he's also shooting fireballs…or ice cubes…or whatever else,…and you wanna make sure that whenever…any of those objects hits the right edge of the screen…
He starts with demonstrating how to create your first project and gather the artwork (aka sprites) and other assets you'll need to build it. Todd then reviews the prebuilt scripts, the bits of code that control the logic of your Scratch projects, and explains how to use the different script types for different functions, such as animating sprites, responding to events such as button clicks, and comparing values. In chapter 3, he covers costumes, and in chapter 4, he shows how to load and play sounds. Finally, he shows how to put it all together into a complete web game, which you can then share with the Scratch community.
- What is Scratch?
- Creating your first project
- Choosing a backdrop for your application
- Creating sprites (reusable graphics) in Scratch
- Working with scripts: animating objects, responding to events, and checking logic
- Switching sprite costumes
- Changing the appearance of sprites with custom-drawn costumes
- Playing sounds
- Building a game with Scratch
Skill Level Beginner
Teaching iOS Programming to Kidswith Todd Perkins1h 1m Beginner
Teach Kids Programming with PHPwith Mark Niemann-Ross1h 39m Beginner
1. Get Started with Scratch
5. Build a Game
Next steps2m 36s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.