first turtle

This is my first turtle !

Log in to post a comment.

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

let angle = 89 // min = 0, max = 90, step = 1
let size = 8 // min = 3, max = 50, step = 1
let xStep = 6.3 // min = 0.1, max = 10, step = 0.1

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(-90, 90);
turtle.pendown();
turtle.setheading(-90-angle / 2);
changeHeading = 1;

// The walk function will be called until it returns false.
function walk(i) {
    
    turtle.circle(size*changeHeading, angle)
    changeHeading *= -1
//    turtle.forward(10);
//    turtle.right(10);
    
    if(turtle.y() < -90){
        turtle.jump(turtle.x() + xStep, 90);
    }
    
    if(turtle.x() > 85) return false;
    return true;
}