pxt-calliope/docs/projects/turtle-spiral.md
Peli de Halleux 2b504d863d
Radiodocsupdate (#1430)
* a few updates

* more updates

* reorder radio blocks

* more shuffling of new radio apis

* fixing hot or ocold

* more doc fixes

* more updates

* fixing docs issues

* more doc fixes

* restore docs errors

* missing packate

* renamed argument of callback

* mssing radio

* more odcs fixes

* lock turtle

* ignore docs for now
2018-10-15 15:32:09 -07:00

36 lines
817 B
Markdown

# Turtle Spiral
## Setting up your project
This project uses an **microturtle** Extension. You'll need to add it to your project to make it work.
* create a new project
* click on the gearwheel menu and click **Extensions**
* select the **microturtle** extension
After the project reloads, you should see the **turtle** category in the blocks.
## Code
A turtle that spirals into the center of the display and back out again.
```blocks
let index = 0
turtle.setPosition(0, 0)
turtle.turnRight()
basic.forever(() => {
for (let index = 0; index <= 4; index++) {
turtle.forward(4 - index)
turtle.turnRight()
}
for (let index = 0; index <= 4; index++) {
turtle.turnLeft()
turtle.back(index)
}
})
```
```package
microturtle=github:Microsoft/pxt-microturtle#v0.0.9
```