adalogo

Class Turtle


public class Turtle
extends java.lang.Object

this is turtle.

Constructor Summary

Turtle(Engine engine)

Method Summary

void
addTurtleListener(Turtle.TurtleListener listener)
void
forward(double step)
Turtle moves forward, will draw line if penDown.
double
getDirection()
Action
getForwardAction()
Action
getPenDownAction()
Action
getPenUpAction()
Point2D
getPosition()
Action
getResetAction()
Action
getTurnLeftAction()
Action
getTurnRightAction()
void
init()
boolean
isPenDown()
void
moveTo(double x, double y)
Turtle jumps to position, will draw line if penDown, keeps direction.
void
penDown()
Turtle will draw line when moving.
void
penUp()
Turtle will not draw line when moving.
void
resetTurtle()
this will be called to remove all drawn lines and reset turtle to default direction and position.
void
turn(double degree)
Turtle turns by degree relativ to current direction.
void
turnTo(double degree)
Tutle turns to given direction.

Constructor Details

Turtle

public Turtle(Engine engine)

Method Details

addTurtleListener

public void addTurtleListener(Turtle.TurtleListener listener)


forward

public void forward(double step)
Turtle moves forward, will draw line if penDown.


getDirection

public double getDirection()


getForwardAction

public Action getForwardAction()


getPenDownAction

public Action getPenDownAction()


getPenUpAction

public Action getPenUpAction()


getPosition

public Point2D getPosition()


getResetAction

public Action getResetAction()


getTurnLeftAction

public Action getTurnLeftAction()


getTurnRightAction

public Action getTurnRightAction()


init

public void init()


isPenDown

public boolean isPenDown()


moveTo

public void moveTo(double x,
                   double y)
Turtle jumps to position, will draw line if penDown, keeps direction.


penDown

public void penDown()
Turtle will draw line when moving.


penUp

public void penUp()
Turtle will not draw line when moving.


resetTurtle

public void resetTurtle()
this will be called to remove all drawn lines and reset turtle to default direction and position. no drawing will occur.


turn

public void turn(double degree)
Turtle turns by degree relativ to current direction. if degree positive turn clockwise, otherwise turn counterclockwise (or the other way around, i don't know).


turnTo

public void turnTo(double degree)
Tutle turns to given direction.