xxxxxxxxxx
62
// declare variables
// globalscope
let x = 200;
let y = 200;
// runs once, before the programs starts drawing
function setup() {
createCanvas(400, 400);
}
// runs 60 fps, constantly drawing and updating our graphics
function draw() {
background(220);
//movement varibles
if (keyIsDown(RIGHT_ARROW)) {
x = x + 5;
}
if (keyIsDown(LEFT_ARROW)) {
x = x - 5;
}
// draw your character here
//horns
line(x - 40, y - 40, x + 5, y + 10)
line(x - 40, y - 40, x - 5, y - 20)
line(x + 40, y - 40, x + 5, y - 10)
line(x + 40, y - 40, x - 5, y + 20)
// face color
colorMode(HSB);
fill('orange');
// face
rectMode(CENTER);
circle(x, y, 40,);
//eye colors
colorMode(HSB);
fill('rgb(0, 255, 0)');
//eyes
circle(x - 10, y - 10, 10);
circle(x + 10, y - 10, 10);
//mouth
ellipse(x, y + 5, 20, 10)
}
function mousePressed() {
save("demonmask.jpg");
}