1. Draw a spiral

_images/scratch-p01-espiral.png

In this practice we are going to move a character so that it draws a spiral with colors on the screen.


  1. We start the Scratch editor.


  2. We delete the cat by clicking on it with the right mouse button and then pressing delete.

    borrar-gato


  3. We added a new character, a polar bear.

    Press the new object button nuevo-objeto

    Then click on Animals Category.

    Then we select the bear2 object.

    _images/scratch-bear2.png


  4. In the Programs tab we create a new function called Startup.

    First click on the button more blocks

    mas-bloques

    Then click on create a block crear-bloque

    Then we change the name of the new block to Home

    _images/scratch-bloque-inicio.png

    Finally we press the button OK


  5. We program the Start function with the following instructions

    _images/scratch-p01-programa-inicio.png

    With this initial program, the polar bear will be placed in the center of the screen at a small size and all previous drawings will be erased. In this way everything will start blank every time we run the program.


  6. Now we will create the variable Side that will store the size of the side of the spiral.

    Within the Data datos tab,

    press create a variable crear-variable

    We change the name of the variable to Side

    _images/scratch-p01-variable-lado.png

    Finally we press the button OK


  7. Finally we will create the program that draws a spiral.

    _images/scratch-p01-programa-espiral.png


  8. Finally we will click on the green flag bandera-verde to see the result:

    _images/scratch-p01-espiral.png

Exercises

  1. Modify the program so that it draws an octagonal spiral. The turns must be 45 degrees and in each turn the Side must change 1. The spiral must stop when the size of the Side is greater than 147.


  2. Modify the program so that it draws a hexagonal spiral (with 60 degree turns)