Turtle Academy just had a system upgrade if you experience any issues. Please try to hard refresh using CTRL + F5.

If the issues continue please contact us.

8. The pen width

Until now you have been using a pen that draws a black line the width of 1 point. The width of the line means how thick the line is. If we want to draw more beautiful things, sometimes we'll want to use a wider or narrower line, or choose a different color. The command to change the pen's width is setwidth followed by a number. The number will represent the new width of the line, counting it in points.
Set the pen width to 5.
To see the wider line we asked for, we will ask the honorable turtle to move forward a little bit.
Draw a 50-point-long line.
Let's play a little bit more with the pen width.
Set the pen to double the width of the line it drew before. Draw a line that is 60 points long.
Before continuing with the next line, let's ask the turtle to turn back diagonally. Any turn angle that the turtle will take now that is between 90 and 270 degrees will make him face backwards from his current direction.
Ask the turtle to turn 135 degrees to the left.
Let's try to draw a line with a changing width. That means a line that has different widths at different places. We will use the help of the loops you learned about before. Try to draw a line that is 100 points long that is divided into 10 lines, each 10 points long. Half of the 10-points-long lines will be three points wide and half of them will be one point wide.
Draw the requested line using only one loop.
The dashed line you have drawn on the previous step could also be the edge (line) of a dashed square. Now you can draw a dashed square, where the length of each of its edges is 100 points. Of course we will use a nested loop, just like we learned before.
Clear the screen and draw a dashed square. Use the turn left command to turn between the edges of the square.
In case you haven't notice by now, the use of the 'up' and 'down' arrow keys on your keyboard can show you the last commands you were using. Using the arrow keys and adding existing commands allows us to experiment with making small changes to the commands we give the turtle. We can see what happens and how it affects the turtle's moves. The sequence of commands we give the turtle is sometimes called a code. In the previous lesson you learned how to draw a regular octagon.
Draw a regular octagon with dashed lines. Each edge (line) of the octagon will be 100 points long.
If you didn't clear the screen between the past tasks, you will see that the square you created is not exactly in the middle of the octagon. Now we will ask you to think a little bit about how to draw a dashed square inside a dashed octagon. Keep in mind: The square should be in the exact middle of the octagon. To make it a little easier, let's say that the octagon should be moved 71 points to the right, and it would be better if you lift your pen from the board between drawing different shapes. It is not very complicated, but because you might want to try it a few times we ask that you clear the screen at the beginning of each command row. If you haven't succeeded, don't worry; on the next lesson you will learn how to make it easier.
Draw a dashed square in the middle of an octagon. First draw the square, then move the turtle. After that, draw the octagon.
TurtleAcademy learn programming for freeYour browser is not supporting canvasWe recomand you to use Chrome or Firefox browsers