Turning
You’ve used code to draw a line. Good work! Now let’s try making the turtle turn around. To do this you need to instruct the turtle not only to move forward, but also to turn right or left.
// Add your action code here
moveAndDraw(50);
turn(90);
moveAndDraw(50);
- What do you think will happen in the code above? Click on
> Act
to see if you were right. turn(90)
turns the cursor 90 degrees right. You can also turn left withturn(-90)
. To change the amount that the cursor turns, simply change the value of the degrees.- Complete the square shape you’ve started by adding the next lines of code and press Run. Keep trying until you get it right.
Challenge
Try to complete each of the challenges below.
- Draw a rectangle: two of the four sides need to be longer.
- Draw a triangle: how many degrees do you need to turn?
- Draw a cross: backwards and forwards work well together.
- Draw a circle: what happens if you turn lots?