Can't get any in the store? Print this and cut to size! You're welcome.
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax Canvas.setpenopacity(1); // Global code will be evaluated once. const turtle = new Turtle(); // The walk function will be called until it returns false. function walk(i) { dashedLine(-95, -60, 95, -60, [1,2,3,2]); dashedLine(-95, -60, -95, 60, [1,2,3,2]); dashedLine(-95, 60, 95, 60, [1,2,3,2]); dashedLine(95, -60, 95, 60, [1,2,3,2]); turtle.jump(-80, -61); turtle.seth(180); turtle.circle(2) turtle.jump(-80, -59); turtle.seth(0); turtle.circle(2); turtle.jump(-80, -61); turtle.goto(-70, -58); turtle.jump(-80, -59); turtle.goto(-70, -62); return false; } function dashedLine(x1, y1, x2, y2, pattern = [500]) { turtle.jump(x1, y1); turtle.setheading(y2 > y1? 90 : 270); let len = Math.sqrt((x2-x1)**2 + (y2-y1)**2); if(x1 != x2) { turtle.setheading((x2-x1 < 0? 180: 0) + Math.atan((y2 - y1) / (x2 - x1))); } let tr = 0; let i = 0; turtle.penup(); while(tr < len) { let inc = pattern[i % pattern.length]; turtle.isdown()? turtle.penup(): turtle.pendown(); turtle.forward(inc + tr > len? len - tr: inc); i++; tr+=inc; } turtle.pendown(); }