Here are a few more things that you might find useful as you write programs that use turtles.
tess.forward(-100)
will move tess backwards, and tess.left(-30)
turns her to the right. Additionally, because there are 360 degrees in a circle, turning 30 to the left will leave you facing in the same direction as turning 330 to the right! (The on-screen animation will differ, though — you will be able to tell if tess is turning clockwise or counter-clockwise!)alex.backward(-100)
to move alex forward!)up
and down
. Note that the methods penup
andpendown
do the same thing.arrow
, blank
,circle
, classic
, square
, triangle
, turtle
.Let’s do an example that shows off some of these new features.
The list of integers shown above is created by printing the range(5,60,2)
result. It is only done to show you the distances being used to move the turtle forward. The actual use appears as part of the for
loop.
One more thing to be careful about. All except one of the shapes you see on the screen here are footprints created by stamp
. But the program still only has one turtle instance — can you figure out which one is the real tess? (Hint: if you’re not sure, write a new line of code after the for
loop to change tess’ color, or to put her pen down and draw a line, or to change her shape, etc.)
Mixed up program
turtle-8-1: The following program uses the stamp method to create a circle of turtle shapes as shown to the left, but the lines are mixed up. The program should do all necessary set-up, create the turtle, set the shape to "turtle", and pick up the pen. Then the turtle should repeat the following ten times: go forward 50 pixels, leave a copy of the turtle at the current position, reverse for 50 pixels, and then turn right 36 degrees. After the loop, set the window to close when the user clicks in it.
Mixed up program
turtle-8-2: The following program uses the stamp method to create a line of turtle shapes as shown to the left, but the lines are mixed up. The program should do all necessary set-up, create the turtle, set the shape to "turtle", and pick up the pen. Then the turtle should repeat the following three times: go forward 50 pixels and leave a copy of the turtle at the current position. After the loop, set the window to close when the user clicks in it.