press 'a' to move forward, 'b' to move backwards, 'c' to move upward, and d to move downward. Pressing the mouse will change costume and theme to cloudy and pressing the key will change background but not move character.
xxxxxxxxxx
var circle1_x
var circle1_y
var rectangle1_x
var rectangle1_y
var rectangle2_x
var rectangle2_y
var circle2_x
var circle2_y
var rectangle3_x
var rectangle3_y
var rectangle4_x
var rectangle4_y
function setup() {
createCanvas(600, 600);
background(32, 20, 61)
circle1_x = 107
circle1_y = 160
rectangle1_x = 90
rectangle1_y = 180
rectangle2_x = 117
rectangle2_y = 180
circle2_x = 110
circle2_y = 260
rectangle3_x= 90
rectangle3_y= 300
rectangle4_x= 120
rectangle4_y = 300
}
function draw() {
let c = color(217,208,222)
let b = color(184,141,160)
let a = color(160,70,104)
let z = color(171,73,103)
strokeWeight(0)
circle(500,0,400)
fill(c)
circle(4,500,300)
fill(c)
circle(300,500,400)
fill(a)
circle(150,485,260)
fill(b)
circle(300,600,200)
fill(a)
circle(400,550,145)
fill(z)
circle(580,500,300)
fill(z)
circle(50,500,210)
fill(b)
rect(rectangle3_x, rectangle3_y, 15, 100);
rect(rectangle4_x, rectangle4_y,15,100);
//stomach
circle(circle2_x,circle2_y,100);
//neck done
rect(rectangle1_x,rectangle1_y,5,40);
rect(rectangle2_x,rectangle2_y,5,40);
//head done
circle(circle1_x,circle1_y,70)
if(mouseIsPressed){
draw_costume()
draw_cloudy()
}
if(keyIsPressed){
background(32, 20, 61)
}
function draw_cloudy(){
circle(70,550,230)
fill(c)
circle(150,550,180)
fill(c)
circle(500,590,190)
fill(a)
circle(200,10,60)
fill(z)
circle(250,10,80)
fill(b)
circle(340,10,89)
fill(z)
circle(130,9,100)
fill(a)
circle(40,10,150)
fill(b)
circle(300,10,30)
}
function draw_costume(){
//costume
background(148,168,154)
stroke(3)
fill(a)
fill(239,176,161)
rect(30,250,60,30)
rect(140,250,60,30)
rect(74,107,70,20)
}
}
function keyPressed(){
if(key == 'a'){
circle1_x +=5
circle2_x +=5
rectangle1_x +=5
rectangle2_x +=5
rectangle3_x +=5
rectangle4_x +=5
}
//press b to move character backwards
if(key == 'b'){
circle1_x -=3
circle2_x -=3
rectangle1_x -=3
rectangle2_x -=3
rectangle3_x -=3
rectangle4_x -=3
}
//press c to move character downards
if(key == 'c'){
circle1_y +=5
circle2_y +=5
rectangle1_y +=5
rectangle2_y +=5
rectangle3_y +=5
rectangle4_y +=5
}
if(key =='d'){
circle1_y -=3
circle2_y -=3
rectangle1_y -=3
rectangle2_y -=3
rectangle3_y -=3
rectangle4_y -=3
}
}