Class OppositeTurtle

java.lang.Object
  extended by SimpleTurtle
      extended by Turtle
          extended by OppositeTurtle

public class OppositeTurtle
extends Turtle

Class for an opposite turtle. An opposite turtle is like a turtle but it turns right when asked to turn left and left when asked to turn right. It goes backward when asked to go forward and forward when asked to go backward. It turns (360-amount) when asked to turn.

Author:
Barb Ericson

Constructor Summary
OppositeTurtle(ModelDisplay modelDisplayObj)
          A constructor that takes a ModelDisplay object
 
Method Summary
 void backward(int amount)
          Method to go backward by a passed amount (actually will go forward)
 void forward()
          Method to go forward (actually go backward)
 void forward(int amount)
          Method to go forward by the passed amount (actually will go backward)
 void turn(int degrees)
          Method to turn by a given amount (actually will turn 360-amount)
 void turnLeft()
          Method to turn left (but a dance turtle will actually turn right)
 void turnRight()
          Method to turn right (but a dance turtle will actually turn left)
 
Methods inherited from class Turtle
drawSquare, drawSquare, drawSquare2
 
Methods inherited from class SimpleTurtle
backward, clearPath, drawInfoString, drop, getBodyColor, getDistance, getHeading, getHeight, getInfoColor, getModelDisplay, getName, getPen, getPenColor, getPenWidth, getPicture, getShellColor, getShowInfo, getWidth, getXPos, getYPos, hide, isPenDown, isVisible, moveTo, paintComponent, penDown, penUp, setBodyColor, setColor, setHeading, setHeight, setInfoColor, setModelDisplay, setName, setPen, setPenColor, setPenDown, setPenWidth, setPicture, setShellColor, setShowInfo, setVisible, setWidth, show, toString, turnToFace, turnToFace, updateDisplay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OppositeTurtle

public OppositeTurtle(ModelDisplay modelDisplayObj)
A constructor that takes a ModelDisplay object

Parameters:
modelDisplayObj - the thing that does the display
Method Detail

forward

public void forward()
Method to go forward (actually go backward)

Overrides:
forward in class SimpleTurtle

forward

public void forward(int amount)
Method to go forward by the passed amount (actually will go backward)

Overrides:
forward in class SimpleTurtle
Parameters:
amount - the amount in pixels

backward

public void backward(int amount)
Method to go backward by a passed amount (actually will go forward)

Overrides:
backward in class SimpleTurtle
Parameters:
amount - the amount in pixels

turn

public void turn(int degrees)
Method to turn by a given amount (actually will turn 360-amount)

Overrides:
turn in class SimpleTurtle
Parameters:
degrees - the amount in degrees

turnRight

public void turnRight()
Method to turn right (but a dance turtle will actually turn left)

Overrides:
turnRight in class SimpleTurtle

turnLeft

public void turnLeft()
Method to turn left (but a dance turtle will actually turn right)

Overrides:
turnLeft in class SimpleTurtle