java.lang.ObjectTurtle
public class Turtle
A class representing a Papert-style Turtle that can be moved about a canvas. This class acts as an initializer and wrapper for the JTF Turtle, so that it can be controlled through the BlueJ interface Note that this class uses a singleton canvas (run as an applet)
Constructor Summary | |
---|---|
Turtle()
Constructor for objects of class Turtle |
Method Summary | |
---|---|
void |
forward()
Moves the turtle forward by one "step" (the size of the turtle; 30 pixels). |
void |
forward(int distance)
Moves the turtle forward the specified distance (in pixels) |
double |
getDirection()
Gets the turtle's current facing (in degrees counterclockwise from the x axis) |
java.awt.Color |
getPenColor()
Returns the color of the turtle's pen. |
java.lang.String |
getPenColorName()
Returns the name of the color of the turtle's pen. |
double |
getSpeed()
Gets the turtle's current speed. |
boolean |
isPenDown()
Gets whether the turtle's pen is down or not. |
void |
left(int angle)
Turns the turtle to the left the specified number of degrees |
void |
penDown()
Puts the turtle's pen down. |
void |
penUp()
Lifts the turtle's pen up. |
void |
printText(java.lang.String message)
Prints the given message on the screen. |
void |
right(int angle)
Turns the turtle to the right the specified number of degrees |
void |
setPenColor(java.awt.Color color)
Sets the color of the turtle's pen. |
void |
setPenColorByName(java.lang.String color)
Sets the color of the turtle's pen, using the name of the color. |
void |
setSpeed(double speed)
Sets the turtle's speed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Turtle()
Method Detail |
---|
public void forward()
public void forward(int distance)
public double getDirection()
public java.awt.Color getPenColor()
public java.lang.String getPenColorName()
public double getSpeed()
public boolean isPenDown()
public void left(int angle)
public void penDown()
public void penUp()
public void printText(java.lang.String message)
public void right(int angle)
public void setPenColor(java.awt.Color color)
public void setPenColorByName(java.lang.String color)
public void setSpeed(double speed)