Click 'Run' to go.
The turtle commands setx, sety, and setxy let you move the turtle to specific (x, y) coordinates. If the pen is down, the turtle will draw a line as it moves to its new coordinates. These commands do not change the turtle's heading.
These three commands, setxy, setx, and sety, will let you place the turtle at exact (x, y) coordinates. If the pen is down, the turtle will draw a line as it travels to its new coordinates. If you need to get somewhere without drawing your path, then lift the pen up before relocating.
The command setxy changes both the x- and y-coordinates of the turtle. With it you can draw from any point to any point on the (x, y) graph.
The command setx changes only the x-coordinate. This causes the turtle to move horizontally. And since the sety command will only change the y-coordinate, it will move the turtle vertically.
These commands let you think of the turtle's movement in terms of its coordinates rather than in terms of its travel distance and direction.
Setx moves the turtle horizontally:
Sety moves the turtle vertically:
The flowchart for this demo:
The imaginary computer code for this demo could look like this:
setx(4); sety(4); pu(); setxy(-5, 5); pd(); fd(10);
Suggested next article:
This article is related to this demo: