
IN REAL LIFE, events can be anything that happens, such as a birthday party, parade, or a snowstorm. In programming, events are things that happen within your program. Scratch has a special collection of blocks for you to use to make things happen in your programs: the Events Block Palette. You’ve already seen one such block—the when green flag clicked block. In this adventure, you learn about the other Event blocks.
Understanding the Role of Events
Until now, all your Scratch programming adventures have used forever loops to repeatedly check whether an event such as a mouse click or a key press is happening. This method works, but it makes it difficult to keep your code and your Scripts Areas organized.
In this adventure, you learn to use Event blocks to detect things that happen within your program.
There are eight blocks in the Events Block Palette. Six of the Event blocks are hat blocks. The other two are stack blocks. Event blocks are color-coded brown.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access