Approved content
The content below is provided by a partner.
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.
Moves the turtle forward by the given amount of steps. If the turtle goes out of the screen, it wraps around.
turtle.forward(1)
Moves the turtle backward by the given amount of steps. If the turtle goes out of the screen, it wraps around.
turtle.back(1)
Turns the turtle in a clockwise fashion by 90 degrees.
turtle.turnLeft()
Turns the turtle in a counter-clockwise fashion by 90 degrees.
turtle.turnRight()
Sets the drawing mode of the turtle.
up
, the turtle leaves no trail (this is the default)down
, the turtle paints the LEDsturtle.pen(TurtlePenMode.Down)
Moves the turtle to a particular location
turtle.setPosition(1,1)
Moves the turtle to the center of the screen, pointing up.
turtle.home()
Determines how many steps per second a trutle may take.
turtle.setSpeed(50)
MIT
(The metadata above is needed for package search.)
microturtle=github:microsoft/pxt-microturtle#v0.0.10