Turtle Sizes and Speeds
SETTURTLESIZE TURTLESIZE SETSTEPSIZE STEPSIZE SETSPEED SPEED SLOWTURTLE
In this section, you will learn about commands to change the turtle’s size, its orientation, the length of its steps, and its speed.
SETTURTLESIZE number
SETTURTLESIZE x-scale y-scale
(SETTURTLESIZE x-scale y-scale)
SETTSIZE
SETTS
Use SETTURTLESIZE
, or its abbreviations SETTSIZE
and SETTS
, to change the size of the turtle. You can also use it to flip the orientation of the turtle horizontally or vertically.
Here is how to change the turtle to these sizes:
The first turtle is the standard size, or SETTURTLESIZE 1
or SETTSIZE 1
or SETTS 1
.
The second turtle is SETTS 2
.
The third turtle is SETTS [1 1.5]
. It is the normal width and 1 and a half times taller.
The fourth turtle is SETTS [2 3]
. It is twice as wide and three times as tall.
If a value is negative, it causes the shape to flip either horizontally (based on the first number), vertically (based on the second number), or both.
(SETTS -1 1)
flips the turtle horizontally at its normal size of 1.
(SETTS 1 -1)
flips the turtle vertically at its normal size of 1.
(SETTS -.5 .5)
makes the turtle half its normal size and flips it horizontally.
(SETTS 1 5)
creates a tall turtle that is 5 times its normal height.
Here is what the four commands above will do to the turtle’s size and orientation.
Note that using an input list of two numbers inside square brackets is the same as putting the entire instruction in parentheses, without the brackets.
SETTS [2 3]
is the same as (SETTS 2 3)
.
To get the turtle back to its normal size, use SETTS [1 1]
.
If the turtle is set to a different shape, the SETTS
commands work in the same way.
This allows you to flip an elephant shape horizontally so that it points in the opposite direction, for example
» Things to Try
What does SETTS -2
do?
How large an input to SETTS
can you use? Is there a limit?
What happens when you turn and move this newly designed turtle?
TURTLESIZE
TSIZE
TURTLESIZE
or its abbreviation TSIZE
reports the current size and orientation of the turtle.
If you entered the instruction SETTS 2
, you would see this:
TURTLESIZE
Result: 2
If you entered the instruction SETTURTLESIZE [-2 4]
, you would see this:
TSIZE
Result: [-2 4]
» Things to Try
Play around with different turtle sizes and see how TURTLESIZE
gives you information about the turtle.
SETSTEPSIZE number-of-pixels
SETSTEPSIZE
changes how far the turtle moves for each step. It sets the distance for a FD 1
command.
If you enter SETSTEPSIZE 10
, telling the turtle to move FD 10
would move it 100 steps.
SETSTEPSIZE
does not alter how much the turtle turns, only how far it moves.
To get the turtle moves back to normal, type SETSTEPSIZE 1
.
STEPSIZE
(see next) reports the current step size.
» Things to Try
Try this:
FD 10
SETSTEPSIZE 10
FD 20
SETSTEPSIZE 3
BK 210
Where did the turtle end up? Is that what you expected?
Try other inputs to SETSTEPSIZE
and explore the results.
How large can the input be? How small? How can you figure that out?
STEPSIZE
STEPSIZE
reports the current step size number.
SETSTEPSIZE 20
STEPSIZE
Result: 20
» Things to Try
Experiment with different inputs to SETSTEPSIZE
and see the results of STEPSIZE
.
SETSPEED number
SETSPEED
allows you to change the speed of the turtle: how fast it moves and how fast it turns.
SETSPEED
takes a number from .1 to 1 as input.
Inputs less than 1 are written as decimal numbers.
If you are not familiar with decimal numbers, perhaps thinking about coins will help.
A dime is one tenth of a dollar, or 10 cents. It is written as .10 (or just .1).
A quarter is one quarter of a dollar, or 25 cents. It is written as .25.
A half dollar is 50 cents, written as .5 (or just .5).
SETSPEED 1
is the normal speed.
SETSPEED .1
is the slowest.
SETSPEED .5
is half speed. This instruction is the same as using SLOWTURTLE
.
Check the turtle’s speed using the SPEED
command (see next).
Use SETSPEED 1
to restore the normal speed.
» Things to Try
Try changing the turtle’s speed, like this:
SETSPEED .4
FD 100
RT 180
Did the turtle move and turn as you expected?
Just for fun, try this and see if you can see how it works:
DRAW
LTURTLES 10
TELL 0 HT
TELL [1 2 3 4 5 6 7 8 9]
EACH [SETSPEED WHO*.1]
FD 100
Learn more about multiple turtles.
SPEED
SPEED
tells you the speed of the turtle.
If you are using more than one turtle, it reports the speed of the first active turtle.
For example:
SETSPEED .7
SPEED
Result 0.7
» Things to Try
Try different turtle speeds and look at the results with SPEED
.
SLOWTURTLE
The command SLOWTURTLE
slows the turtle to half speed when it moves and turns.
It is the same as typing SETSPEED .5
.
If you are not familiar with using decimals, this is an easy solution to slowing down the turtle.
Use SPEED
to see what the turtle’s speed is.
Use SETSPEED 1
to restore the normal speed.
» Things to Try
How can you prove that SLOWTURTLE
is the same as SETSPEED .5
?
What instructions would you use?