var clouds = [];
var dragonBreath = false;
var dragonBreathPos = 0;
var dragonBreathLngth = 30;
var dragonWings = false;
var dragonWingsPos = 0
function setup() {
createCanvas(400, 600);
colorMode(RGB, 255, 255, 255, 1);
}
function draw() {
background(random(255), 255, 255);
for (i = 0; i < clouds.length; i++) {
var currentObj = clouds[i];
cloud(currentObj.xpos, currentObj.ypos, currentObj.size);
currentObj.xpos += 0.5;
currentObj.ypos += random(-0.5, 0.5);
if (clouds[i].xpos > width + 20) {
clouds.splice(i, 1);
}
}
rightWing();
leftWing();
body();
if (dist(mouseX, mouseY, 170, 225) < 50) {
print('mouseX');
showDragonBreath();
}
}
function showDragonBreath() {
dragonBreath = true;
fire1();
fire2();
fire3();
}
function rightWing() {
noStroke()
fill(125, 4, 235);
var rw1 = {
x: 220,
y: 245
},
rw2 = {
x: 380,
y: 350
},
rw3 = {
x: 330,
y: 200
},
rw4 = {
x: 220,
y: 245
};
quad(rw1.x, rw1.y, rw2.x, rw2.y, rw3.x, rw3.y, rw4.x, rw4.y);
}
function leftWing() {
noStroke()
fill(125, 4, 235);
var lw1 = {
x: 180,
y: 245
},
lw2 = {
x: 20,
y: 350
},
lw3 = {
x: 70,
y: 200
},
lw4 = {
x: 180,
y: 245
};
quad(lw1.x, lw1.y, lw2.x, lw2.y, lw3.x, lw3.y, lw4.x, lw4.y);
}
function body() {
fill(125, 75, 200);
noStroke();
strokeWeight(3);
var t1 = {
x: 220,
y: 450
},
t2 = {
x: 300,
y: 400
},
t3 = {
x: 280,
y: 380
},
t4 = {
x: 300,
y: 370
};
quad(t1.x, t1.y, t2.x, t2.y, t3.x, t3.y, t4.x, t4.y);
noStroke()
fill(125, 75, 200);
ellipse(200, 340, 120, 300);
noFill();
stroke(125, 4, 235);
strokeWeight(3);
var scl1 = {
x: 175,
y: 255,
w: 50,
h: 20,
r: 10,
},
scl2 = {
x: 170,
y: 285,
w: 60,
h: 20,
r: 10,
},
scl3 = {
x: 165,
y: 315,
w: 70,
h: 20,
r: 10,
},
scl4 = {
x: 160,
y: 345,
w: 80,
h: 20,
r: 10,
},
scl5 = {
x: 165,
y: 375,
w: 70,
h: 20,
r: 10,
},
scl6 = {
x: 170,
y: 405,
w: 60,
h: 20,
r: 10,
},
scl7 = {
x: 175,
y: 435,
w: 50,
h: 20,
r: 10,
};
rect(scl1.x, scl1.y, scl1.w, scl1.h, scl1.r);
rect(scl2.x, scl2.y, scl2.w, scl2.h, scl2.r);
rect(scl3.x, scl3.y, scl3.w, scl3.h, scl3.r);
rect(scl4.x, scl4.y, scl4.w, scl4.h, scl4.r);
rect(scl5.x, scl5.y, scl5.w, scl5.h, scl5.r);
rect(scl6.x, scl6.y, scl6.w, scl6.h, scl6.r);
rect(scl7.x, scl7.y, scl7.w, scl7.h, scl7.r);
noStroke()
fill(125, 4, 200);
ellipse(180, 490, 35, 60);
ellipse(220, 490, 35, 60);
fill(125, 75, 200);
ellipse(170, 510, 35, 35);
ellipse(230, 510, 35, 35);
noStroke()
fill(125, 4, 200);
ellipse(140, 320, 25, 60);
ellipse(260, 320, 25, 60);
fill(125, 75, 200);
ellipse(140, 330, 20, 25);
ellipse(260, 330, 20, 25);
noStroke()
fill(125, 4, 200);
ellipse(200, 160, 150, 100);
fill(125, 4, 200);
triangle(155, 130, 195, 130, 180, 75);
triangle(210, 130, 250, 130, 225, 75);
fill(100, 4, 200);
triangle(170, 110, 185, 110, 180, 95);
triangle(220, 110, 235, 110, 225, 95);
fill(125, 4, 200);
arc(200, 200, 80, 80, 0, PI, OPEN);
fill(0);
ellipse(185, 215, 10, 20);
ellipse(215, 215, 10, 20);
fill(150);
ellipse(175, 155, 20, 30);
ellipse(225, 155, 20, 30);
fill(0, 255, 165);
ellipse(175, 155, 10, 10);
ellipse(225, 155, 10, 10);
}
function fire1() {
fill(255, 100, 40);
strokeWeight(15);
stroke(255, 100, 40, 0.5);
var sml1 = {
x: 185,
y: 231,
h: 15,
w: 20
},
smr1 = {
x: 215,
y: 231,
w: 20,
h: 15
};
ellipse(sml1.x, sml1.y, sml1.w, sml1.h);
ellipse(smr1.x, smr1.y, smr1.w, smr1.h);
}
function fire2() {
fill(255, 100, 40);
strokeWeight(15);
stroke(255, 100, 40, 0.5);
var sml1 = {
x: 185,
y: 231,
h: 15,
w: 20
},
sml2 = {
x: 180,
y: 248,
w: 30,
h: 20
},
smr1 = {
x: 215,
y: 231,
w: 20,
h: 15
},
smr2 = {
x: 220,
y: 248,
w: 30,
h: 20
};
ellipse(sml1.x, sml1.y, sml1.w, sml1.h);
ellipse(sml2.x, sml2.y, sml2.w, sml2.h);
ellipse(smr1.x, smr1.y, smr1.w, smr1.h);
ellipse(smr2.x, smr2.y, smr2.w, smr2.h);
}
function fire3() {
fill(255, 100, 40);
strokeWeight(15);
stroke(255, 100, 40, 0.5);
var sml1 = {
x: 185,
y: 231,
h: 15,
w: 20
},
sml2 = {
x: 180,
y: 248,
w: 30,
h: 20
},
sml3 = {
x: 170,
y: 272,
w: 40,
h: 30
},
smr1 = {
x: 215,
y: 231,
w: 20,
h: 15
},
smr2 = {
x: 220,
y: 248,
w: 30,
h: 20
},
smr3 = {
x: 230,
y: 272,
w: 40,
h: 30
};
ellipse(sml1.x, sml1.y, sml1.w, sml1.h);
ellipse(sml2.x, sml2.y, sml2.w, sml2.h);
ellipse(sml3.x, sml3.y, sml3.w, sml3.h);
ellipse(smr1.x, smr1.y, smr1.w, smr1.h);
ellipse(smr2.x, smr2.y, smr2.w, smr2.h);
ellipse(smr3.x, smr3.y, smr3.w, smr3.h);
}
function cloud(x, y, size) {
fill(255, 255, 255);
noStroke();
arc(x, y, 25 * size, 20 * size, PI + TWO_PI, TWO_PI);
arc(x + 10, y, 25 * size, 45 * size, PI + TWO_PI, TWO_PI);
arc(x + 25, y, 25 * size, 35 * size, PI + TWO_PI, TWO_PI);
arc(x + 40, y, 30 * size, 20 * size, PI + TWO_PI, TWO_PI);
}
function mousePressed() {
var newCloud = {
xpos: mouseX,
ypos: mouseY,
size: random(0.5, 5)
};
clouds.push(newCloud);
}