Terrapin Resources
Turtle Appearance

SETSHADOW     SHADOW     LOCKSHAPE     UNLOCKSHAPE

In this section, you will learn about commands to change the turtle’s appearance. In addition to these commands, the turtle’s appearance will also change when you use SETPC (SETPC) or SETTURTLESIZE (SETTS). See the pages for colors and size.


SETSHADOW number


Use SETSHADOW to make a shadow for the turtle. This is called a drop shadow, which is a visual effect that makes the turtle appear to be raised above its background by adding a shadow behind it. You can imagine a light shining on the turtle from the upper left of the screen, creating a shadow.

The turtles in the picture were given these shadow commands:

SETSHADOW 4
SETSHADOW 9
SETSHADOW 12

Note that if you make the turtle larger with SETTURTLESIZE, the shadow is not proportionally larger. For example, SETSHADOW 2 always sets the same amount of shadow, regardless of the size of the turtle.

If you are using multiple turtles, the shadow is applied to all of them, unless you use commands to talk to individual turtles and set the shadows separately, like this:

DRAW LTURTLES 6
TELL 0 HT TELL [1 2 3 4 5]
EACH [FD WHO*30 SETSHADOW WHO*3]

SHADOW (see next command) reports the current value.

» Things to Try

What types of numbers can you use as input?

Can you use a negative number? Can you use a fraction or a decimal number?

What is the lowest and highest number you can use?

Can you figure out how to remove the shadow?

How can SHADOW tell you what the normal turtle’s shadow value is?


SHADOW


SHADOW reports the current shadow setting of the turtle.

If you entered the instruction SETSHADOW 2, you would see this:

SHADOW Result: 2

» Things to Try

Play around with different size shadows see how SHADOW gives you information about the the setting.


LOCKSHAPE


LOCKSHAPE prevents the turtle from rotating.

If you enter LOCKSHAPE and the type RT 90, for example, the turtle, no matter what shape it looks like, will not turn.

This can be handy if your turtle looks like an elephant and you don’t want it to ever appear upside down!

If you are using multiple turtles, all the turtles’ shapes will be locked.

Even though you have locked the shape so it cannot turn, HEADING still reports its true direction.

Drag the elephant from the Animals category of the Toolbox onto the turtle. (Release your mouse button when you see the turtle surrounded by a small red box. That means that the shape will change to the elephant.) You can open the Toolbox from the Window menu.

Note that some of the animals that appear to be facing right in the Toolbox will have a heading of 270° when you drag them onto the turtle. So, they are ready go move in that direction.

LOCKSHAPE
LT 45
REPEAT 2 [FD 100 RT 90 FD 200 RT 90]
HEADING
Result: 225

» Things to Try

Drag different shapes onto the turtle from the Toolbox (open the Toolbox from the Window menu).

Use LOCKSHAPE to keep the turtle shape from rotating.

How do you think you can it to start rotating again?


UNLOCKSHAPE


UNLOCKSHAPE resets the turtle’s heading to its true direction. This cancels the LOCKSHAPE command.

Here is the elephant again, after entering the UNLOCKSHAPE command.

» Things to Try

Experiment with shapes. Lock their heading with LOCKSHAPE, and then unlock their heading with UNLOCKSHAPE.

You can use these commands in programs you write.