From Test-Scratch-Wiki

The general shape of a Hat block.

A Hat Block, also called an Event Block, is a 積木 that is designed to start a 程式. This makes them essential for making 專案. All the 帽子式積木 are either 控制類積木 or 事件類積木. In the 實驗查看器, the first word of their name is capitalised.

帽子式積木 are useful in 事件驅動程式設計 .


As 帽子式積木 are designed to start a script, they are shaped so no blocks can go on top of them — this is done by rounding the blocks' top. The bottom of 帽子式積木 are the same as 堆疊式積木.

点击绿旗时 // 这就是帽子式积木.
定位到 [鼠标 v] 位置


There are eleven 帽子式積木 in Scratch. Four are used for extensions. They are:

A wanted hat block is When () Is True.[1] It is available in some Scratch Modifications. This block can be reproduced by doing the following:

當 @greenflag 被點擊
  等待直到 <condition>
  廣播訊息 [true v]
  等待直到 <<condition> 不成立>
當收到訊息 [true v]
. . .


Without 帽子式積木, scripts could only be activated manually, and not at all online. Each Hat block has a different method for getting activated — this is so different scripts can be started at different times. There are four different ways to activate a script — when the 綠旗 is clicked, a key is pressed, the 角色 is clicked, or when a broadcast is received.

An example for when the When I Receive () block can be used as follows:

當收到訊息 [Next Level v]

Snap! Hat 積木相關

In the Scratch Modification Snap!, 帽子式積木 are used in definitions of Custom Blocks (procedures). These 帽子式積木 contain an image of the block on them. The custom block carries out the script attached to the bottom of the hat block.

帽子式積木 cannot be created in BYOB 3.1, but may be available in BYOB/Snap! 4.0.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.