xxxxxxxxxx
101
function setup() {
createCanvas(500,500);
noStroke();
}
//function to draw the background
function sBack(){
background("#81B8FF");
//clouds
fill(255);
arc(80, 80, 60, 60, PI, PI*2);
arc(130, 80, 80, 100, PI, PI*2);
arc(180, 80, 60, 70, PI, PI*2);
arc(350, 140, 60, 60, PI, PI*2);
arc(400, 140, 80, 100, PI, PI*2);
arc(450, 140, 60, 70, PI, PI*2);
arc(90, 240, 60, 60, PI, PI*2);
arc(140, 240, 80, 100, PI, PI*2);
arc(190, 240, 60, 70, PI, PI*2);
//ground
fill("#328F35");
rect(0, 320, 500, 180);
}
//function to draw the character
function sCharacter(){
let skinColor = "#FED9AF";
let denim = "#385EB5";
//hair
fill(1);
arc(240, 155, 120, 120, PI, PI*2);
rect(180, 155, 120, 55);
//head
fill(skinColor);
circle(240, 155, 80);
//bangs
fill(1);
triangle(185, 140, 240, 100, 290, 140)
//torso
fill(denim);
rect(190, 205, 100, 90);
fill(skinColor);
triangle(220, 205, 240, 245, 260, 205);
rect(235, 230, 10, 65)
//buttons
fill(1);
rect(235, 235, 10, 50);
rect(235, 290, 10, 10);
circle(225, 245, 7);
circle(225, 265, 7);
circle(225, 285, 7);
//arms
fill(skinColor);
rect(162, 225, 25, 80);
rect(293, 225, 25, 80);
//jacket sleeves
fill(denim);
rect(162, 225, 25, 60);
rect(293, 225, 25, 60);
triangle(162, 225, 187, 205, 187, 225);
triangle(293, 205, 293, 225, 318, 225);
//legs
fill(" #D89E34");
rect(190, 435, 45, 25);
rect(245, 435, 45, 25);
//pants
fill(1);
rect(190, 295, 100, 25);
triangle(190, 320, 212, 430, 240, 320);
triangle(240, 320, 265, 430, 290, 320);
triangle(180, 455, 212, 315, 250, 455);
triangle(230, 455, 265, 315, 300, 455);
//face
fill(255);
rect(218, 149, 12, 12);
rect(250, 149, 12, 12);
fill(1);
rect(220.5, 151, 7, 7);
rect(252.5, 151, 7, 7);
noFill();
strokeWeight(3);
stroke("#F46442");
arc(240, 170, 12, 12, 0.5, PI-0.5);
//jewelry
strokeWeight(1);
stroke("yellow");
arc(280, 180, 10, 25, -PI/2, PI/2+0.7);
arc(200, 180, 10, 25, 0, -PI/2);
arc(240, 190, 35, 70, PI/2-0.8, PI/2+0.8);
noStroke();
}
function draw(){
sBack();
sCharacter();
print(mouseX + " " + mouseY);
}