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) \))
end

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))
end
  • 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.