Revision as of 10:28, 4 August 2023 by Wilhelm43 (talk | contribs) (Interwiki)

This article is about the block. For the rotation style feature, see Rotation Style.
Set Rotation Style ()
set rotation style [ v]
Category Motion
Type Stack
Introduced in 2.0

The Set Rotation Style () block is a Motion block and a stack block. The block changes the Rotation Style of the sprite in-project. Regardless of the style, the variable direction will still change.


The drop-down menu for the Set Rotation Style () block
Main article: Rotation Style

There are three options for this block: all around, left-right, and don't rotate. All around means the sprite can face any of the 360 degrees. It is the default. Left-right means the sprite can only face left or right, with all directions less than 0 being left, and all directions greater than or equal to 0 being right. The sprite will also be horizontally flipped when facing left in the left-right style. Don't rotate means that the sprite always faces as in 90°.

Example Uses

This block can be used if a sprite must move in different manners throughout the project. Here are a few possible uses:

  • Animations
set rotation style [all around v]
point in direction (-90)
say [Look! I'm upside-down!] for (2) secs
say [This is cool! I feel like a bat!] for (2) secs
set rotation style [left-right v]
say [And now I'm on the ground again.] for (2) secs
  • Allowing a person to look left or right
when gf clicked
  if <mouse down?> then
    set rotation style [all around v]
    point towards (mouse pointer v)
    if <key (left arrow v) pressed?> then
      set rotation style [left-right v]
      point in direction (-90)
    if <key (right arrow v) pressed?> then
      set rotation style [left-right v]
      point in direction (90)
  • Forcing a sprite not to turn while paused
when I receive [game paused v]
set rotation style [don't rotate v]

In Scratch 1.x

Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.

Despite not being available, this can be added via Shift-Click-R. Scratch-Objects => ScratchSpriteMorph => instance => motion ops

  setRotationStyleTo: t1
      rotationStyle _ t1
      ^ self

Then, Scratch-Objects => ScratchSpriteMorph => class => block specs => blockSpecs

  #- ('set rotation style %n' #- #setRotationStyleTo: 2)

The block will appear as follows:

set rotation style (2)

See Also

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