Class Turtle

java.lang.Object
  extended by greenfoot.Actor
      extended by Turtle

public class Turtle
extends greenfoot.Actor

A basic turtle.

Version:
1.0.2
Author:
Poul Henriksen

Constructor Summary
Turtle()
           
 
Method Summary
 void addedToWorld(greenfoot.World world)
          We need to make sure that our own representaion of the location is the same as the World's.
 void move(double distance)
          Moves the turtle the given distance.
 void moveTo(double newX, double newY)
          Moves the turtle to the given position.
 void penDown()
          Puts the pen down.
 void penUp()
          Takes the pen up.
 void setColor(java.lang.String newColor)
          Set the color of the pen.
 void setLocation(double x, double y)
          Set the location of the turtle.
 void setLocation(int x, int y)
          We need to override this method, so we can interactively move objects.
 void turn(double degrees)
          Turns the 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
 

Constructor Detail

Turtle

public Turtle()
Method Detail

addedToWorld

public void addedToWorld(greenfoot.World world)
We need to make sure that our own representaion of the location is the same as the World's.

Overrides:
addedToWorld in class greenfoot.Actor

move

public void move(double distance)
Moves the turtle the given distance.


moveTo

public void moveTo(double newX,
                   double newY)
Moves the turtle to the given position.


penDown

public void penDown()
Puts the pen down.


penUp

public void penUp()
Takes the pen up.


setColor

public void setColor(java.lang.String newColor)
Set the color of the pen. Accepted colours are: "red", "black", "blue", "yellow", "green", "magenta", "white"


setLocation

public void setLocation(double x,
                        double y)
Set the location of the turtle.


setLocation

public void setLocation(int x,
                        int y)
We need to override this method, so we can interactively move objects. This method should not be used by subclasses. Use the setLocation(double x, double y) instead

Overrides:
setLocation in class greenfoot.Actor

turn

public void turn(double degrees)
Turns the turtle.