A LOGO turtle library for micro:bit in MakeCode
Перейти к файлу
Sarah Rietkerk 7079369118
Bump 0.0.10 (#7)
Bumping for newest thumbnail
2023-06-13 13:54:30 -07:00
.vscode updated tasks file 2017-12-08 06:08:40 -08:00
.gitignore initial release 2017-12-07 22:31:26 -08:00
.travis.yml missing pxt install 2017-12-08 10:38:11 -08:00
LICENSE Initial commit 2017-12-07 22:21:20 -08:00
Makefile initial release 2017-12-07 22:31:26 -08:00
README.md enabling calliope too 2017-12-15 14:34:14 -08:00
SECURITY.md Microsoft mandatory file (#4) 2023-06-05 10:33:29 -07:00
icon.png Updated microturtle thumbnail (#6) 2023-06-13 13:34:56 -07:00
pxt.json Bump 0.0.10 (#7) 2023-06-13 13:54:30 -07:00
test.ts updated APIs 2017-12-07 23:04:37 -08:00
tests.ts auto-start 2018-09-11 09:00:25 -07:00
tsconfig.json initial release 2017-12-07 22:31:26 -08:00
turtle.ts auto-start 2018-09-11 09:00:25 -07:00

README.md

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 #turtle-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 #turtle-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 #turtle-turnleft

Turns the turtle in a clockwise fashion by 90 degrees.

turtle.turnLeft()

turn right #turtle-turnright

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

turtle.turnRight()

pen #turtle-pen

Sets the drawing mode of the turtle.

  • up, the turtle leaves no trail (this is the default)
  • down, the turtle paints the LEDs
turtle.pen(TurtlePenMode.Down)

set position #turtle-setposition

Moves the turtle to a particular location

turtle.setPosition(1,1)

home #turtle-home

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

turtle.home()

set speed #turtle-setspeed

Determines how many steps per second a trutle may take.

turtle.setSpeed(50)

License

MIT

Supported targets

  • for PXT/microbit
  • for PXT/calliope

(The metadata above is needed for package search.)