From Test-Scratch-Wiki

Revision as of 02:32, 3 April 2018 by Dnowba (talk | contribs) (Created page with "{{:Eng:Color () is Touching ()? (block)/translate}} {{Zho/积木 | 名 = 颜色 () 碰到颜色 ()? | sb = 顏色 [#ea235c] 碰到顏色 [#cba81a] ? | 类别 = Zho:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

颜色 () 碰到颜色 ()?
顏色 [#ea235c] 碰到顏色 [#cba81a] ?
类别 侦测类积木
形狀 菱形积木

The Color () is Touching ()? 积木 is a 侦测类积木 block and a 菱形积木. The block checks if a color on its 角色 is touching another color; if the color on its sprite is touching the color, the block returns true; if it is not, it returns false.

The color in a color square can be chosen by clicking on the color square and then clicking anywhere in the Scratch editor.

The block as seen in Scratch 1.2

In versions of Scratch before 1.2, this block was called Color () is Over ()?.


As this block detects if a color on its sprite is touching a color, it is widely used in collision detecting.

Some common uses for the Color () is Touching ()? block:

  • Moving a sprite until a color on its sprite touches a color
重複直到 <顏色 [#ea235c] 碰到顏色 [#cba81a] ?> 
  面朝 [Sprite2 v] 向
  移動 (10) 點
  • Making a sprite do things if a part of a sprite touches a color; for example, if the sprite's mouth touches blue (water), it drinks some water
  如果 <顏色 [#ffffff] 碰到顏色 [#0000ff] ?> 那麼 
    造型換成 [drinking water v]
    等待 (1) 秒
    造型換成 [not drinking water v]
  • Stopping bullets when they hit walls of a specific color
  如果 <顏色 [#ffd700] 碰到顏色 [#f321a5] ?> 那麼 
  • In a maze, sensing if a sprite has hit a dead-end
  如果 <顏色 [#000000] 碰到顏色 [#007f00] ?> 那麼 
    說出 [Uh-oh, I hit a dead end!] (2) 秒


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