xxxxxxxxxx
142
let x;
let y;
let sp;
function setup() {
x = 200;
y = 600;
sp = 5
createCanvas(1000, 1000);
}
function draw() {
x += sp;
y += sp;
background(255, 0, 255);
stickfigure((x + 200), (y - 200), 50);
k(x, y);
o((x + 115), y);
n((x + 200), y);
a((x + 350), y);
// x += random(-5, 5);
// y += random(-5, 5);
if (x <= 0) {
spx = 2
}
if (y <= 0) {
spy = 2;
}
if (x >= 975) {
spx = -2;
}
if (y >= 945) {
spy = -2;
}
}
function stickfigure(x, y, size) {
strokeWeight(4);
noFill();
//head;
ellipse(x, y, size);
//body;
line(x, y + (size / 2), x, y + (size / 2) + size);
//left leg;
line(x, y + (size / 2) + size, x - (size / 2), y + (size * 2));
//right leg;
line(x, y + (size / 2) + size, x + (size / 2), y + (size * 2));
//left arm;
line(x, y + (size / 2), x - (size / 2), y + size);
//right arm;
line(x, y + (size / 2), x + (size / 2), y + size);
//left eye;
line((x - (size / 6)), (y - (size / 6)), (x - (size / 6)), (y + (size / 8)));
//right eye;
line((x + (size / 6)), (y - (size / 6)), (x + (size / 6)), (y + (size / 8)));
//mouth;
line((x - (size / 8)), (y + (size / 4)), (x + (size / 8)), (y + (size / 4)));
}
function k(x, y) {
line(x, y, (x + 50), (y - 75));
line(x, (y - 75), x, (y + 75));
line(x, y, (x + 50), (y + 75));
}
function o(ex, wy) {
ellipse(ex, wy, 75, 150);
}
function n(xgh, ygh) {
line(xgh, (ygh - 75), xgh, (ygh + 75));
line(xgh, (ygh - 75), xgh + 75, (ygh + 75));
line((xgh + 75), (ygh - 75), (xgh + 75), (ygh + 75));
}
function a(exgh, wygh) {
line((exgh - 37.5), (wygh + 75), (exgh), (wygh - 75));
line((exgh + 37.5), (wygh + 75), (exgh), (wygh - 75));
line((exgh - 17.5), wygh, (exgh + 17.5), wygh)
}