+21622886281
Scratch

Events Blocks in Scratch

In Scratch, events blocks are blocks of code that are triggered by events. An event is something that happens in the program, such as a sprite being clicked on or a key being pressed. Events blocks are used to create interactive programs that respond to user input or other events.

Here are some examples of events blocks in Scratch:

  1. “When flag clicked” block: This block allows you to specify a set of blocks that will be executed when the green flag is clicked.
  2. “When this sprite clicked” block: This block allows you to specify a set of blocks that will be executed when a particular sprite is clicked on.
  3. “When key pressed” block: This block allows you to specify a set of blocks that will be executed when a particular key is pressed.
  4. “When [sensor] > [number]” block: This block allows you to specify a set of blocks that will be executed when a particular sensor (such as a microphone or a distance sensor) reads a value above a certain number.

Events blocks are an essential part of programming in Scratch, and they allow you to create interactive programs that respond to user input and other events.

Scripts that carry this block will activate once the green flag is clicked.

These scripts can activate other scripts and activate the whole program.

Scripts placed under this block will activate when the specified key is pressed.

Scripts that carry the block will activate once its sprite or sprite clone is clicked. Contrary to its final name, the block will also execute the clone’s script when it is clicked.

Scripts that carry this block will be triggered once the specified background has been toggled on the Stage.

This block allows blocks to be executed when the microphone detects sound.

Scripts starting with this block will be called once the specified broadcast has been sent by a calling script.

If an Always block sends the broadcast faster than the attached script can finish running, the script will restart without reaching the blocks at the end.

The block sends a broadcast throughout the Scratch program.

This broadcast block allows scripts to send broadcasts without any waits in its script.

Broadcasts are a great way to communicate sprites and scripts.

The block sends a broadcast throughout the Scratch project. All scripts that are stopped with the When I receive() block and are set to broadcast will activate.

This broadcast block allows scripts to send broadcasts and have them wait until all broadcast-enabled scripts complete




0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top