12. Draw flowers

In this lab we are going to program several user blocks to draw flowers on the screen when pressing the arrow keys.

_images/scratch3-p11-screen.png


  1. We start the Scratch editor.


  2. Press the language button boton-idioma in the top bar and choose English.


  3. We add a new extension with the button add extension aniadir-extension down left.

    We select the Pencil extension to be able to draw.

    _images/scratch3-extension-lapiz.en.png

    A new icon will appear in the code bar, the Pencil boton-lapiz, with dark green instructions.


  4. We create a new block called start.

    First click on the button my blocks boton-misbloques

    Then click on create a block boton-crear-bloque

    Then we change the name of the new block to start


  5. The start block will be used to start the program. It will clear the screen, raise the pencil with zero color, and place the cat in the center with small size.

    _images/scratch3-p11-inicio.png


  6. We create a new block called Point.

    First click on the button my blocks boton-misbloques

    Then click on create a block boton-crear-bloque

    Then we change the name of the new block to Point

    Click on Add a number or text entry and give it the name Radio

    _images/scratch3-p11-crear-bloque-punto.png

    Finally, click on the OK button.


  7. The Point block will be used to draw a point on the screen with a size that depends on the Radius parameter.

    _images/scratch3-p11-punto.png


  8. We create a new block called Flower.

    First click on the button my blocks boton-misbloques

    Then click on create a block boton-crear-bloque

    Then we change the name of the new block to Flower

    Click on Add a number or text entry and give it the name Radio


  9. The Flower block will be used to draw 12 points in a circle, around the cat, with a size that depends on the Radius parameter.

    _images/scratch3-p11-flor.png


  10. Now we write a little code to test the flower block.

    _images/scratch3-p11-upkey.png


  11. Press the green flag bandera-verde to test the operation of the program.

    By pressing the Up Arrow key on the keyboard, the cat will draw a flower of colored circles on the screen.


  12. Next we make a program to draw a flower made up of several circles of points.

    _images/scratch3-p11-downkey.png


  13. Press the green flag bandera-verde to test the operation of the program.

    By pressing the Down Arrow key on the keyboard, the cat will draw a flower of various colored circles on the screen.


  14. To finish we make a program to draw flowers in various places on the screen.

    To define the numbers of the go to x y instruction we can move the cat where we want the flower to appear.

    _images/scratch3-p11-rightkey.png


  15. Press the green flag bandera-verde to test the operation of the program.

    By pressing the Right Arrow key on the keyboard, the cat will draw four flowers in four different positions on the screen.

    _images/scratch3-p11-screen.png



Challenges

  1. Modify the program so that the flower function does not change the color of the points and they all have the same color. Draw a flower made up of a ring of large red dots on the outside and a small ring of green dots on the inside.


  2. Make a program that draws five flowers positioned as in the olympic games logo.

    _images/scratch3-p11-olympic-flag.png