Blocks

We are going to make our first program in Scratch:

  1. Click on the Code tab, in the Events menu
  2. Drag the "When green flag clicked" block:

imagen.png

3. Click on Motion now.

 4.  Drag the block "move 10 steps" to the right area and place it by dragging it just below the "When flag clicked" block:

imagen.png

 and match it.

imagen.png

5 Click on the green flag to run the program.

imagen.png

You'll see Scratch cat move a little to the right! It moves 10 steps, corresponding to 10 pixels.

The program terminates only because it has finished executing all instructions. Therefore, you do not have to press the red Stop button (next to the green flag) to finish. The Stop button will be useful when our program has control blocks that involve continuous repetition of execution (this will be seen later).

Activity: Moving the blocks

We continue with our project.

Instead of 10 steps, make it advance 50: To do this, click on the number 10, delete the 10 with the keyboard and write 50, and try it again.

Managing blocks: You will notice that the blocks in the program area can be moved.

The blocks remain linked, and when we drag a block, everything below it will move with it, but it will detach from its upper blocks.

After the blue "move 50 steps" block, add the "wait 1 second" block, which is in the Control blocks.

Also add several more blue blocks, so that they are interspersed, as shown in the following image, and try it. To do this you can use Duplicate, a very interesting option that appears when you right-click on a set of blocks.

imagen.png

Activity: Deleting blocks

To delete a block (and everything below it):

To remove a block that is nested in the middle of other blocks: unpack it from the top, unpack everything from the bottom, delete it, and fit the upper blocks with the lower ones. The following image shows how to delete the "move 50 steps" block that is in the middle:

imagen.png

To undo any action, you can use the Ctrl-Z key combination

Finally, save your work with the name blocks.sb3


Revision #6
Created 24 November 2023 21:12:54 by Ana López Floría
Updated 9 January 2025 20:40:47 by Ana López Floría