Skip to content

Turtle graphics editor based on Microsoft MakeCode (aka PXT)

License

Notifications You must be signed in to change notification settings

plirof/pxt-turtle

 
 

Repository files navigation

Turtle Editor

pxt-turtle is a programming environment fur turtle graphics, based on Microsoft MakeCode. It's meant for teaching beginners in programming fundamentals.

Features

Animated turtle graphics

Simple

(Turtle design taken from https://github.com/ycatch/p5.turtle.js, CreateJS used as animation framework)

Visual programming

Quadrats Blocks

Further examples

Tree

Hilbert and Koch curves

Hilbert Curve Koch Curve

API

declare namespace turtle {
    function forward(distance: number): void;
    function backward(distance: number): void;
    function turnRight(angle: number): void;
    function turnLeft(angle: number): void;
    function penUp(): void;
    function penDown(): void;
    function home(): void;
    function x(): number;
    function y(): number;
    function heading(): number;
    function setSpeed(speed: Speed): void;
    function setPenColor(color: number): void;
    function setPenSize(size: number): void;
    function show(): void;
    function hide(): void;
    function goto(xpos: number, ypos: number): void;
    function printAndMove(text: string): void;
    function print(text: string): void;
    function clear(): void;
    function drawSprite(sprite: Sprite): void;
}

declare const enum Speed {
    Slow, Normal, Fast, Fastest
}

declare interface Sprite {
    readonly width: number;
    readonly height: number;
}

declare namespace time {
    function wait(delay: number): void;
    function now(): number;
    function year(ts: number): number;
    function month(ts: number): number;
    function day(ts: number): number;
    function hours(ts: number): number;
    function minutes(ts: number): number;
    function seconds(ts: number): number;
}

declare namespace console {
    function log(msg: string): void;
}

How to build

pxt-turtle uses Yarn for dependency management. To install the needed packages, simply execute yarn in the project root folder.

Start in development mode

yarn start

Publish as GitHub pages

yarn build --githubpages

About

Turtle graphics editor based on Microsoft MakeCode (aka PXT)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.1%
  • HTML 2.0%
  • CSS 0.9%