java.lang.Objectgreenfoot.Actor
Trtl
public class Trtl
A basic turtle.
Field Summary | |
---|---|
double |
direction
The direction the turtle is facing. |
Constructor Summary | |
---|---|
protected |
Trtl()
|
Method Summary | |
---|---|
protected void |
addedToWorld(greenfoot.World world)
We need to make sure that our own representaion of the location is the same as the World's. |
static Trtl |
makeTrtl()
Create a new Trtl. |
static void |
move(Trtl _this,
double distance)
Moves the Trtl the given distance. |
static void |
penDown(Trtl _this)
Puts the pen down. |
static void |
penUp(Trtl _this)
Takes the pen up. |
static void |
setColor(Trtl _this,
java.lang.String newColor)
Set the color of the pen. |
void |
setLocation(int x,
int y)
Set the location of the turtle. |
protected static void |
setLocation(Trtl _this,
double x,
double y)
Set the location of the Trtl _this. |
static void |
turn(Trtl _this,
double degrees)
Turns a turtle. |
Methods inherited from class greenfoot.Actor |
---|
act, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getX, getY, intersects, setImage, setImage, setRotation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public double direction
Constructor Detail |
---|
protected Trtl()
Method Detail |
---|
protected void addedToWorld(greenfoot.World world)
addedToWorld
in class greenfoot.Actor
public static Trtl makeTrtl()
public static void move(Trtl _this, double distance)
_this
- The Trtl to be moved.distance
- The number of pixels to move the turtle
in the direction it's facing.public static void penDown(Trtl _this)
_this
- The Trtl whose pen is to be lowered.public static void penUp(Trtl _this)
_this
- The Trtl whose pen is to be lifted.public static void setColor(Trtl _this, java.lang.String newColor)
_this
- The Trtl whose pen-color is being set.newColor
- The name of the color to use;
accepted colours are:
"red", "black", "blue", "yellow", "green", "magenta", "white"public void setLocation(int x, int y)
setLocation
in class greenfoot.Actor
protected static void setLocation(Trtl _this, double x, double y)
setLocation(int,int)
public static void turn(Trtl _this, double degrees)
_this
- The Trtl to be turned.degrees
- How many degrees clockwise to turn the turtle.