Approved content

The content below is provided by a partner.

microsoft/pxt-microturtle 0.0.10 GitHub

micro turtle Build Status

A LOGO-like turtle library for the micro:bit in MakeCode.

turtle.setPosition(0, 0)
turtle.setSpeed(45)
basic.forever(() => {
    turtle.forward(4)
    turtle.turnLeft()
})

The turtle is a single pixel moving on the micro:bit screen. It starts in the center at 2,2, pointing up.

Reference

forward

Moves the turtle forward by the given amount of steps. If the turtle goes out of the screen, it wraps around.

turtle.forward(1)

back

Moves the turtle backward by the given amount of steps. If the turtle goes out of the screen, it wraps around.

turtle.back(1)

turn left

Turns the turtle in a clockwise fashion by 90 degrees.

turtle.turnLeft()

turn right

Turns the turtle in a counter-clockwise fashion by 90 degrees.

turtle.turnRight()

pen

Sets the drawing mode of the turtle.

turtle.pen(TurtlePenMode.Down)

set position

Moves the turtle to a particular location

turtle.setPosition(1,1)

home

Moves the turtle to the center of the screen, pointing up.

turtle.home()

set speed

Determines how many steps per second a trutle may take.

turtle.setSpeed(50)

License

MIT

Supported targets

(The metadata above is needed for package search.)

microturtle=github:microsoft/pxt-microturtle#v0.0.10