EZ Math Movie, Tutorials, Turtle Graphics, setH

Aiming the turtle

The setH command means 'set heading'. The turtle's heading is an angle that describes the direction in which the turtle is aimed. The direction that the turtle is aimed is the direction in which it will move for the forward and back commands. You can set this direction with the setH command.

The direction is stated as an angle considered in standard position. That is, it is an angle with 0 degrees aimed directly right, with angles greater than 0 degrees considered rotated counter-clockwise, and with angles less than 0 degrees rotated clockwise.

Common headings in degrees

Common turtle headings


The setH command spins the turtle in place and aims it in a certain direction. Examples here work with angles in degrees. The following code would aim the turtle directly right:


This code would aim the turtle down:


Running the example program

The example program demonstrates how to aim the turtle, and then move forward in that new direction.

Angle measurement: Degrees Radians

Go on input

Sorry, apparently this browser does not support HTML 5 canvas tag graphics.

Edit: Runtime          View: Starter Suggestion

To runtime:


Editor width: Normal Wide








Next tutorial: Angle measurement


Here is a link to a related article at EZ Programing Demos:

Set heading

All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.

Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com

EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com

Custom Search