O'Reilly logo

Adventures in Coding by Chris Minnick, Eva Holland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required