Operators are used in Scratch to determine one value compared to another, or to generate a random value. Using the Operators scripts, you can check if one value is greater than, less than, or equal to another value. This information can then be used in your Control script blocks to choose whether to proceed in your project or not. See how Operators scripts work in this movie.
- View Offline
- [Voiceover] Operators allow you some extra flexibility…with your If Blocks.…For example,…instead of something being true or false,…or yes or no, or the answer to a question,…you can check to see if something is greater than…or less than or equal to something else.…We can actually even get random numbers…using operators,…we can perform math, like addition, subtraction,…multiplication and division.…We can combine multiple statements that are true or false…using an And statement,…so both of them have to be true…in order to move through the If statement.…
We can use Or, so either one of them can be true…to go through the If statement.…We can use Not, so it has to be evaluated as False…to go through the If statement.…We also have options to join two values together…that are Text.…So you can use a lot of different kinds…of data or information using these operators.…As an example, I have this wizard on the screen…and when I click the wizard, he shoots a lightning bolt.…Notice that it gets stuck at 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