Page 86 - iPrime_V2.2_class5
P. 86
SCRATCH BLOCKS
Blocks are codes or commands used to create programs in Scratch. These puzzle
shaped looking blocks connect each other vertically like a jigsaw puzzle. To use
a block, simply select and then drag it onto your coding area. To add multiple
blocks to a script, drag new blocks into the location in the script where you want
them to appear. You can add new blocks above or below the existing blocks.
The blocks are arranged in different categories. You can see these categories under
the Code tab.
Motion Blocks
They are colour-coded dark blue and are used to control
the sprite movement. When you click on the Motion
button, you will see the programming blocks that can be
used with your sprite for its placement, direction, rotation
and movement. Let’s program your sprites with some code.
Step 1 Click on the Motion block.
Step 2 Drag the “move 10 steps” block to coding area.
Step 3 Change the “10” to “50” by clicking in the block and typing 50.
Step 4 Double-click on the block in the Script area to see your sprite,
move 50 pixels to the right (towards the face of the sprite).
Step 5 To move the sprite backwards, drag "move 10 steps" block
and change 10 to -70. This will move the sprite to the left
(in the opposite direction of the face of sprite).
More Motion Blocks
Step 1 Drag the “turn 15 degrees” block to the previous
block of code and release it below the previous 'move'
block. It will attach itself to the 'move' block.
Step 2 Add more blocks. Double-click on the blocks to play
the animation and see your sprite move.
Events Blocks
They are colour-coded yellow and are used to sense
events, which run the scripts like when a sprite is pressed, a
key is pressed, or the green flag is clicked. They are placed
at the top of any script. They control starting of the scripts.
The first block present in control is the “when green flag
clicked” block.
84 iPRIME (Ver. 2.2)–V

