5.2.6 Drawing a flower

View

There are many ways to draw a flower, depending on your creativity and Scratch skills. Let us show one of the flowers you can draw.  In the Inner Loop we want to change the colour of the pen ink after every 15 steps.  The inner loop will repeat for 5 times.

 

Figure 144: Drawing a flower

 

With this repeat until loop, the sprite will repeat until a certain condition is met. The pen always starts drawing in the direction of the middle, because the first Motion block that runs after the pen down block is go to x: 0 y: 0. so the pen will draw a line as it moves to the centre of the Stage.

The pen does not stop at the edge of the Stage, because you have not yet told the repeat until loop what condition it is checking. This means the condition can never be met, so the loop will run forever. To stop the sprite, you must use a sensing block.

Time to fix your repeat until loop so that it stops when you want it to. You are looking to figure out if the (invisible) sprite is touching the edge of the Stage, so you need a Sensing block — in this case, the touching block.  We will discuss Sensing blocks in more detail in Module 6.


Figure 145: Sensing block stops the repeat until loop

 

By adding the touching block into the repeat until loop and select edge. Then the loop will run until the (invisible) sprite touches the edge of the Stage. 

With the repeated drawing, we can create unusual patterns that suit our thinking and design.

Last modified: Wednesday, 6 October 2021, 3:47 PM