From Test-Scratch-Wiki

Revision as of 14:37, 19 April 2018 by Dnowba (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

回转方式设为 ()
迴轉方式設為 ()
类别 动作类积木
形狀 条形积木
加入於 2.0

回转方式设为 () 积木,原文为 Set Rotation Style (),是个动作类条形积木。这个积木会改变专案当中角色回转方式。不论方式如何,变量 方向 就是会改变。

选项

主页:Zho:回转方式

这个积木上有三个选项:不设限、左-右、不旋转。「不设限」表示角色可以面向 360 度的任何方向,这是默认方式。 「左-右」则表示角色只可以面向左或是右,and any other directions are rounded. The sprite will also be horizontally flipped when facing left in the left-right style. 「不旋转」则表示角色始终面向 90°的方位。

用法示例

如果角色必须在整个专案中以不同的方式移动,则可以使用此积木,以下是一些可能的用途:

  • 动画
迴轉方式設為 [不設限 v]
面朝 (-90 v) 度
說出 [瞧!我倒立了。] (2) 秒
說出 [酷!我就像蝙蝠一样!] (2) 秒
迴轉方式設為 [左-右 v]
說出 [现在我又回到地面了] (2) 秒
  • 用来让人物左右张望
當 @greenflag 被點擊
重複無限次 
  如果 <滑鼠鍵被按下?> 那麼 
    迴轉方式設為 [不設限 v]
    面朝 [鼠標 v] 向
  
    如果 <[向左 v] 鍵被按下?> 那麼 
      迴轉方式設為 [左-右 v]
      面朝 (-90 v) 度
    end
    如果 <[向右 v] 鍵被按下?> 那麼 
      迴轉方式設為 [左-右 v]
      面朝 (90 v) 度
    end
  end
end
  • 当暂停时强制让角色停止旋转
當收到訊息 [game paused v] //game paused 意为游戏暂停
迴轉方式設為 [不旋轉 v]

在 Scratch 1.x 版

虽然没有这个积木可用,但可以通过 按下Shift+R键 来添加。Scratch 物件 => ScratchSpriteMorph => instance => motion ops

 setRotationStyleTo: t1
     rotationStyle _ t1
     ^ self

接着是 Scratch-Objects => ScratchSpriteMorph => class => block specs => blockSpecs

 #- ('迴轉方式設為 %n' #- #setRotationStyleTo: 2)

这个积木会呈现如下样子:

迴轉方式設為 (2)

参见

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