hwestphal / pxt-turtle

Turtle graphics editor based on Microsoft MakeCode (aka PXT)

Home Page:https://hwestphal.github.io/pxt-turtle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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)

https://hwestphal.github.io/pxt-turtle

License:MIT License


Languages

Language:TypeScript 97.1%Language:HTML 2.0%Language:CSS 0.9%