Events are things that happen- a button press, clicking on a particular object or sprite, pressing a key on the keyboard, or starting the Scratch app by clicking the green flag. Events scripts are there for you to have the option to respond to those events when they happen. For example, you can change the appearence of a sprite when it is clicked. See how Events work in this movie.
- View Offline
- [Voiceover] Events scripts allow you to respond…to things that happen, for example,…when the green flag is clicked,…when a key is pressed, when the sprite was clicked, etc.…Using these events, you can add interactivity…to your applications.…Let's say, for example, that we wanted…to move the ladybug here on the screen…with the keyboard.…Well, we know that we're going to need to respond…to the four directional buttons at least.…So I'm going to drag out four of these…when key pressed events…just like this.…
Now I'm going to need…to handle up, down, left, and right.…So in the drop-down where it says space…in the top left one, I'm going to click that arrow…and I'm going to choose the up arrow.…And to the right of that I'm going…to choose down arrow.…And then I'm going to do left and right as well.…So left there, and then right there.…So we want to respond when the key is pressed.…The first step is actually turning the sprite…in the right direction.…To do that, we'll go over to Motion,…and we'll use the point in direction script.…
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