From Test-Scratch-Wiki

Translate: - English - 中文 
This zho is about the block. For more information on the value this block reports, see Mouse X (value).
鼠标的 X
滑鼠游標的 x
类别 侦测类积木
形狀 椭圆形积木

The Mouse X 积木 is a 侦测类积木 and a 椭圆形积木. The block holds (reports) the 滑鼠游标's current 滑鼠游标的 X.

用法示例

As this block helps report where the mouse-pointer's current location, it is useful in sensing things with the mouse.

Some common uses for the Mouse X block:

  • Depending on where the mouse is, performing a different action
當 [空白 v] 鍵被按下
如果 <(滑鼠游標的 x) > [100]> 那麼 
  重複 (10) 次 
    效果 [幻影 v] 改變 (10)
  end
  等待 (1) 秒
  效果清除

  y 改變 (50)
  等待 (0.5) 秒
  y 改變 (-50)
end
  • Helping to make a virtual slider
重複無限次 
  x 設為 (滑鼠游標的 x)
end
重複無限次 
  說出 (字串組合 (滑鼠游標的 x) 和 (字串組合 [, ] 和 (滑鼠游標的 y)))
end

应用

Main article: List of Block Workarounds

This block can be replicated with the following code:

Note Note: This requires a 角色 dedicated to finding the x座標 of the mouse
重複無限次 
  定位到 [滑鼠游標 v] 位置
  變數 [Mouse X v] 設為 (x 座標)
end

参见