From Test-Scratch-Wiki

For the Operators block with the same name, see () of () (Operators block).
() 的 ()
([x 座標 v] \( [角色1 v] \))
類別 偵測類積木
形狀 橢圓形積木
加入於 1.2

The () of () 積木 is a 偵測類積木 and a 橢圓形積木. The block will report a specified value of the specified 角色 or the 舞台.

Below are the values that can be reported:


This block allows sprites and the Stage to have access to other sprites' special values. With this, 專案 can have a lot of connectivity between sprites.

This block renders eight blocks unnecessary:

Also, as of Scratch 1.4, the SpriteName area can have an expression/variable put into it so that a script can access any other sprite's variables or properties given that sprite's name. This is useful in projects where one wants to be able to generalize things:

變數 [index v] 設為 [0]
重複 (清單 [names v] 的項目數 :: list) 次 
  變數 [index v] 改變 (1)
  替換第 (index) 項於 [values v] 成 ([myVar v] \( (清單第 (index) 項項目\( [names v] \) :: list) \))

Some common uses for the () of () block:

  • Making a sprite follow another by setting their X and y 座標s to the X and y 座標s of the other, plus or minus a certain amount:
當 @greenflag 被點擊
  定位到 x: (([x 座標 v] \( [角色2 v] \)) - (10)) y: (([y 座標 v] \( [角色2 v] \)) - (10))
  • Waiting for a different sprite to reach a certain costume
等待直到 <([造型編號 v] \( [角色2 v] \)) = (target)>
  • Checking volume to adjust a sprite's own volume accordingly
音量設為 ([音量 v] \( [角色2 v] \)) %
Cookies help us deliver our services. By using our services, you agree to our use of cookies.