Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

This is outstanding! Well done. Do you have any more example programs .. I'd love to see some more ideas of what you have drawn with it

(+1)

Thank you! I didn't really get around to creating a bunch of examples. I have this wobbly tree though:

reset_changes();
let angle = 60;
rewire_calls("forward", {
    fn snake(n) {
        arc(n/2, angle);
        left(180);
        arc(n/2, -angle);
        left(180);
    }
    "snake"
});
rewire_calls("back", {
    fn snake_back(n) {
        left(180);
        snake(n);
        left(180);
    }
    "snake_back"
});

fn set_color(depth) {
    if depth < 3 {
        color(37, 102, 31);
    } else {
        color(73, 43, 16);
    }
}

fn tree(depth) {
    if depth == 0 {
        return;
    }

    let len = (depth+1).log() * 10;

    set_color(depth);
    left(angle/2);

    forward(len);
    tree(depth-1);
    back(len);

    right(angle);

    forward(len);
    tree(depth-1);
    back(len);

    left(angle/2);
    set_color(depth+2);
}

right(angle/2);
tree(6);
left(angle/2);
left(180);
reset_changes();
tree(6);
left(180);