We will be learning how to create lines and sketches using programming.
The Repeat block has a drop down menu. We see question marks in it. If you click on it, you will see a list of numbers. You can select a number depending on how many times you need to repeat an action. In our case we shall select 4.
You can choose an action, in this case the block with a right arrow on it. You need to drag this block from the middle panel to the right panel and place it inside the Repeat block. The repeat block can accommodate any number of commands. So if you press the Orange colored Run button you will see the image on the screen moving towards right four times, each time it will draw a segment of the line thus completing the full line.
In this level we need to draw six lines placed below each other. The pencil holder stands at the top of the lines. We will be using three command blocks.
- The right arrow to draw a line
- The Left Arrow to come back to the position
- The Jump block to jump downwards
Now we need to repeat these three commands six times to draw six lines. Therefore we can put these commands in a Loop. We will drag and place the Pink colored Repeat block and place it under the Orange colored block. Then we will place the three green colored blocks in it as displayedin the above image. As we need to repeat the commands six times therefore we need to select the number 6 in the Repeat block's drop down menu.
If you click on the run command, you will see the lines being drawn one by one till the last line is drawn. Then the level completes. You can click on the images for an enlarged view.
In this level you need to complete the castle drawing using the Loops. Let us see how many commands can be repeated. From the place where the Pencil holder is standing we can draw line using
- Right arrow
- Up arrow
- Right arrow
- Down arrow
We can repeat these four commands three times to complete the sketch. Therefore you need to first place the Repeat block below the Orange block. Then place the four arrow blocks in it in the same order shown above. Then click and select in the drop down box the number 3.
If you press the Run button you will see the Castle sketch completed using the programming command we provided.
In this level we are expected to complete the sketch in 4 Loops. The Pink block is already in it's place and number 4 is selected. Looking the position of the Pencil holder we can deduce that he will move towards Right first and then to Down to create one stair. If you count there are four stairs. Therefore we can repeat these two commands 4 times to draw four stairs. Therefore drag and drop the above two Arrow blocks inside the Repeat block.
If you press the Run button you will see the four stairs are generated. You can now proceed to the next level. Press Continue instead of Try again in the pop up window that appears.
This is level 6. In this level you need to complete 3 Up stairs and # Down stairs. You can use two Repeat blocks for this. You can create a Up stair using a Up arrow and a Right arrow, You can create a Down stair with a Right arrow and a Down arrow. You can repeat each Loop 3 times. Place the Blue blocks inside the pink blocks as shown above.
If you press the Run button, you will see all the six stairs completed.
You need to finish the pattern using two loops already in place. We can draw a line from where the Pencil holder is standing bu using a Right arrow. Then we need to use a Jump block. It is a blue block with dotted arrow on it. Similarly we can use the Down arrow to draw a downward line and then a Jump Block to jump downwards once. We can place two blocks each in the Pink blocks as shown above.
Now if you press the Run button you will see the pattern is completed. Now you can move to the next level.
If we need to create a stair as shown in the image above, we will need one Up arrow and two Right arrows. The we will repeat these steps three times to complete the 3 stairs.
Use the Pink Repeat block and then place three Green blocks in it as shown above. Select 3 in the Pink block. Then press the Run command to complete the stairs.
In this level we are asked to find out the easiest way to complete the stairs. We can use a Right arrow and a Down arrow to draw a stair. The we will repeat these steps 4 times to draw four stairs.
use the Pink block first. Then place one Blue Right arrow and a Down Arrow inside the Pink block. Now select number 4 in the Pink block.
If you press the Run button you will see the stairs completed. Now you can proceed to the next step.
This is the 10th and the last level in this Stage and in the first Course. You can see 4 arrows, 4 jump blocks a Repeat block and a set color block. There is one additional block named 'Set Color', It can be used to change the color of the lines below it. There are several colors to choose from. You can use this level to create colorful sketches by programming blocks.
From the next article we will look at the Second Course of Code Studio in Code.org