2.3.6 The Rotation Block
The rotation style is a motion block in Scratch which changes the rotation of the sprite. It allows 3 types which are (1) rotation from left to right, (2) rotation all around and (3) no rotation. The figure below shows blocks that you can use to set your rotation style. This block is called “Set rotation style”.
Figure 67: The Set Rotation Style block
Example
Rotation of a sprite in the opposite direction by using the rotation style block
Step 1: set the event
Step 2: put the rotation block
Step 3: Add a return function to allow it to rotate. The return function needs to have a value of more than 90 degrees.
That is how you can set the rotation in an opposite direction or to face any angle.
Figure 68: Rotation of the Cat
Another option to rotate a sprite is by clicking on the sprite and selecting directions, from there, you can rotate to any angle that you want.
Figure 69: Rotation of the Cat sprite with different angle
The keyboard can also be used to direct and control your sprite in Scratch. This is done by motion blocks and event blocks. You can set coordinates to move a sprite to a given position and you can also use keys to set the direction of any element.
Figure 70: Use keys to set the direction of any element
When you are controlling the sprite using the left and right arrows, the sprite is moving along the X-axis. To move the sprite upwards and downwards, you use the up and down arrows to move along the Y axis. Please look at Figure 70 for an example. Conditions can be set to any key.
There is another option that would allow us to rotate a sprite and animate it using costumes. This is done by creating different costumes and giving each costume its own behaviours. After setting up those behaviours, give conditions must be seton how each event is going to follow on each other.
Example
To make the sprite rotate to different positions using change of costumes.
I have created 2 costumes for this sprite. I want it to turn up and down whenever I click to different keys. I have created 2 costumes and when I click on Space, the first costume will show and when I click on Green Flag another costume will show.
Figure 71: Two costumes for the cat sprite
Step 1: You start with setting the event.
Step 2: Add “Forever” loop and an “IF” condition.
Step 3: Add a key that is going to be clicked to trigger the event.
Step 4: Set what you want to happen when that key is clicked.
If you followed the steps correctly, it should look like this:
Figure 72: Cat rotation using change of costumes