Pencil Code Reference > new Turtle
new Turtle creates a new turtle.
new Turtle can create a new turtle with any color shell.
Name the turtle by setting a variable. Once the turtle has a variable
sally, the turtle can be moved by coding a command after
sally = new Turtle orange sally.fd 50
Any number of turtles can be created. Be sure to use a different name for each turtle.
Turtles receive their commands to move instantly, and after receving commands, they all begin moving at the same time. (For more info about this, see animation queues.) In the next example,
r is given its commands before
b, but they both start moving at the same time.
r = new Turtle red r.rt 90 r.lt 180, 50 b = new Turtle blue b.lt 90 b.rt 180, 50
wear to change the turtle’s shell to a different color or replace its shell with an image.
car = new Turtle car.fd 100 car.wear '/img/icon-car', 50
Sprite to make a blank turtle-like object that you can draw yourself using