lab6lib
Class Karel

java.lang.Object
  extended by lab6lib.Karel

public class Karel
extends java.lang.Object

A class that creates Karel the robot and allows the user to move Karel.

Author:
Adrienne M Decker Created on: Feb 22, 2007

Constructor Summary
Karel()
          Creates a new instance of Karel.
 
Method Summary
 void addToDrawingCanvas(DrawingCanvas canvas, java.awt.Point startingPoint)
          In order to see Karel, you must add him to a graphics.DrawingCanvas at a particular point.
 void faceEast()
          Tells Karel to face East.
 void faceNorth()
          Tells Karel to face North.
 void faceSouth()
          Tells Karel to face South.
 void faceWest()
          Tells Karel to face West.
 void move(java.lang.Integer numberOfSteps)
          Tell Karel to move in his current direction a specified number of steps.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Karel

public Karel()
Creates a new instance of Karel. Karel's dimension is 61 pixels wide by 113 pixels tall.

Method Detail

addToDrawingCanvas

public void addToDrawingCanvas(DrawingCanvas canvas,
                               java.awt.Point startingPoint)
In order to see Karel, you must add him to a graphics.DrawingCanvas at a particular point.

Parameters:
canvas - The DrawingCanvas to put Karel upon.
startingPoint - The point where Karel should first be located.

faceNorth

public void faceNorth()
Tells Karel to face North. No matter what direction Karel was previously, he will turn to face North if this method is called.


faceSouth

public void faceSouth()
Tells Karel to face South. No matter what direction Karel was previously, he will turn to face South if this method is called.


faceEast

public void faceEast()
Tells Karel to face East. No matter what direction Karel was previously, he will turn to face East if this method is called.


faceWest

public void faceWest()
Tells Karel to face West. No matter what direction Karel was previously, he will turn to face West if this method is called.


move

public void move(java.lang.Integer numberOfSteps)
Tell Karel to move in his current direction a specified number of steps. Each one of Karel's steps is equivalent to 10 pixels.

Parameters:
numberOfSteps - The number of steps Karel should move.