Basic Turtle Commands
|
|
Movement |
|
backward (distance in pixels) parameter must be an integer Move the turtle backwards the specified distance. |
|
center () Center the turtle in the display pane. |
|
forward (distance in pixels) parameter must be an integer Move the turtle forward the specified distance. |
|
home () Return the turtle to its default (home) state. |
|
left (degrees to turn) parameter must be an integer Rotate the turtle to the left (counterclockwise). |
|
right (degrees to turn) parameter must be an integer Rotate the turtle to the right (clockwise). |
|
setHeading (degrees) parameter must be an integer Set the direction the turtle is pointing in. |
|
setPosition (new X coordinate,
new Y
coordinate) parameters must be integers Move the turtle to the specified coordinates. |
|
Information |
|
java.awt.Dimension |
getDisplaySize () Return the size of the turtle's display pane. The value returned is of type java.awt.Dimension. |
java.awt.Point |
getPos () Return the current position of the turtle. The value returned is of type java.awt.Point. |
boolean |
isVisible () Determine if the turtle is visible. The value returned is boolean. |
Drawing |
|
clearDisplay () Clear the screen but leave the turtle where it is. |
|
hideTurtle () Hide the turtle so it will not be seen while drawing. |
|
penDown () Put the turtle's pen back down so it will draw when moving. |
|
penPaint () Return the drawing version of the pen after erasing. |
|
penUp () Lift the turtle's pen so it doesn't draw when moving |
|
setPenColor (color) parameter must be a Java Color Set the pen color for the trail the turtle leaves. |
|
setPenWidth (width in pixels) parameter must be an integer Set the pen width for the trail the turtle leaves. |
|
setDiplayColor (color) parameter must be a Java Color Set the display's background color. |
|
showTurtle () Shows the turtle, making it visible. |
|
Updating |
|
updateDisplay () Update the display with any turtle drawing. |
|
setAutoUpdate (true / false) parameter must be boolean Sets a flag indicating whether to automatically update the display after each turtle command that affects it. |
|
setAutoUpdatePause (pause length
in milliseconds) parameter must be a long Sets the number of milliseconds the system pauses after performing an automatic update. |