Sensing scripts are there to ask questions.Is sprite A touching sprite B? Is sprite C a certain color? Many of these questions have yes or no answers, that can be used in your control scripts to run or not to run a certain script. In this movie, see how to use the Sensing scripts in your Scratch creations, and why you might need them to perform tasks in your apps.
- View Offline
- [Voiceover] Sensing scripts are there…to detect information.…If you look at them, you'll notice…that they're different shaped from most…of the other scripts that we've looked at.…If you look at the motion script,…most of these scripts are semi-rectangular…with rounded edges and with notches…on the top and the bottom.…But the sensing scripts have pointed edges…and they're hexagons for the most part.…But there's also these circular ones.…The scripts that are hexagons are…for putting inside of the control…if-then-else statements.…
So you can see those hexagon shapes are right there.…So these are values that are true or false.…And then we also have these rounded ones.…And the rounded ones are values.…These will give us, for example, maybe a number value.…Notice that at the end of the hexagonal shapes,…you're going to see a question mark.…So it's evaluated as true or false.…And it's then plugged into an if statement.…So let's just see an example of that now.…
So here we have a very simple app.…And I'm going to click the run button…
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