lab6lib
Class Turtle

java.lang.Object
  extended by lab6lib.Turtle

public class Turtle
extends Object

A class that represents the Turtle from LOGO. Turtle can be told how to move and to rotate. Created: Mon Nov 27 21:08:21 2000

Version:
Author:
Phil Ventura, modified by Adrienne Decker

Constructor Summary
Turtle()
          Creates a new instance of Turtle.
 
Method Summary
 void addToDrawingCanvas(DrawingCanvas canvas, Point startingPoint)
          Adds the turtle to the drawing canvas specified at the point specified.
 void moveForward(Integer numberOfSteps)
          Moves the turtle forward a specific number of steps in the current direction it is facing.
 void rotate(Integer degrees)
          Rotate the turtle to this degree.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Turtle

public Turtle()
Creates a new instance of Turtle. The turtle will have a dimension of approximately 14 pixels by 14 pixels and will appear the color black. It will first appear heading North.

Method Detail

addToDrawingCanvas

public void addToDrawingCanvas(DrawingCanvas canvas,
                               Point startingPoint)
Adds the turtle to the drawing canvas specified at the point specified.

Parameters:
canvas - The DrawingCanvas to add the turtle to.
startingPoint - The point where the turtle should be first located.

rotate

public void rotate(Integer degrees)
Rotate the turtle to this degree. Zero(0) degrees is north, 90 is west, 180 is south and 270 is east.

Parameters:
degrees - The degree heading to set the turtle facing.

moveForward

public void moveForward(Integer numberOfSteps)
Moves the turtle forward a specific number of steps in the current direction it is facing. Steps for the turtle are each two pixels long.

Parameters:
numberOfSteps - The number of steps the turtle should move.