Lesson 1.1
Activity
Now, it’s time to look at how events help us tell computers what we want them to do!
Unit 0: Getting Started with Computer Science
Today’s Mission!
Tell your computer how to make a sprite perform a response after an event of your choosing occurs.
Scratch Project: Open a New Project
Scratch Project: Set the Stage
1. Pick a sprite
2. Pick a background
Scratch Project: Add an Event
3. Click the shortcut button (at the left).
4. Next, drag the event block to your coding workspace. This creates a new event in your program.
3. Pick an event block (“when green flag clicked’)
4. Drag the event block to your workspace
Scratch Project: Add a Response
5. Click the shortcut button (at the left).
6. Next, drag the motion block to your coding workspace and change “10” to “30” degrees
Scratch Project: Add a Response
Congratulations...
You just created your first program!!
You gave the computer instructions on how to use an event block to move your sprite using Scratch
Scratch Project: Sequencing Blocks
Remember our discussion of sequencing?
You can use events to have many things happen in a sequence, by using blocks stacked one after another. The program will run each block in order from top to bottom.
Let’s create a sequence of blocks in your Scratch.
Scratch Project: Sequencing Blocks
You already have these blocks in place
Next:
1. Click and drag the ‘wait ___ seconds” block
2. Click and drag the “turn____ degrees” block
Keep adding blocks (alternating the direction of the turn)
Scratch Project: Sequencing Blocks
What happened to your sprite when you clicked the green flag?
How many things did the event trigger? In what sequence did these things happen?
Scratch Project: Parallel Blocks
Remember our discussion of parallelism?
You can use events to trigger sets of things that happen in parallel, at the same time.
Let’s create a parallel sequence of blocks using Scratch.
Scratch Project: Parallel Blocks
Add a parallel flow to your Scratch project.
Make sure the same event block is used at the start of each chain of blocks!
In parallel flow, two or more events can be triggered at the same time.
Scratch Project: Parallel Blocks
What happened to your sprite when you clicked the green flag?
How many things did the event trigger? In what sequence did these things happen?
Lesson 0.2
Close Out
Unit 0: Getting Started with Computer Science
Scratch Project: Mission Checklist
All done with your project? Check each of these steps:
Once you’ve finished, you can silently begin working on your workbook.
Let’s Review! Lesson Vocabulary
Discussion: Events and Responses