toyGraphics / com.anysolo.toyGraphics / Turtle

Turtle

class Turtle

Allows to use turtle graphics like in Logo language.

This is the simplest way to start working with computer graphics. You command the turtle to turn left or right and to go forward or backward. It draws on the window while it moving. You also can lift the turtle's pen up and move without drawing.

Constructors

<init>

Turtle(window: Window)

Allows to use turtle graphics like in Logo language.

Properties

window

val window: Window

Functions

backward

fun backward(distance: Int): Unit

forward

fun forward(distance: Int): Unit

home

fun home(): Unit

penDown

fun penDown(): Unit

Put the pen down. Turtle is going to draw line wherever is goes.

penUp

fun penUp(): Unit

Lift the pen up. Turtle is going to move without drawing

setColor

fun setColor(color: Color): Unit

set the color of the pen using Color class.

fun setColor(color: Int): Unit

Set one of 16 colors using integer number 0 .. 15

turnLeft

fun turnLeft(angle: Double): Unit

turnRight

fun turnRight(angle: Double): Unit