
float firstvariable;
float secondvariable;
float dir;
float dir2;
void setup() {
size(640, 480);
firstvariable=458;
secondvariable= 10;
fill(0, 0, 0);
background(0, 0, 0 );
dir = -.25;
dir2 = .25;
}
void draw() {
noStroke();
fill(204, 255, 255);
rect(200 , 0, 270, 60);
//background
fill(0, 0, 0);
rect(200, 60, 270, 20000);
fill(0, 102, 102);
rect(200, 60, 270, 400);
fill(0, 102, 102);
rect(200, 60, 270, 400);
noStroke();
fill(0, 153, 153);
rect(200, 280, 200, 10);
noStroke();
fill(0, 153, 153);
rect(200, 180, 200, 10);
noStroke();
fill(0, 153, 153);
rect(270, 130, 200, 10);
noStroke();
fill(0, 153, 153);
rect(270, 230, 200, 10);
noStroke();
fill(0, 153, 153);
rect(270, 330, 200, 10);
//shark
noStroke();
fill(210, 180, 140);
triangle(200, 460, 335, 150, 470, 460);
noStroke();
fill(255, 218, 185);
triangle(235, 460, 335, 225, 435, 460);
if (keyPressed == true) {
fill(255);
}
else {
fill(0);
}
triangle(270, 460, 335, 300, 400, 460);
//nose
noStroke();
fill(255, 255, 255);
triangle(320, 185, 335, 150, 350, 185);
noStroke();
fill(255, 255, 255);
triangle(320, 185, 335, 225, 350, 185);
//eyes
noStroke();
fill(0, 0, 0);
triangle(350, 260, 370, 230, 385, 260);
noStroke();
fill(0, 0, 0);
triangle(285, 260, 300, 230, 320, 260);
//teeth
noStroke();
fill(255, 255, 255);
triangle(270, 460, 280, 430, 290, 460);
noStroke();
fill(255, 255, 255);
triangle(290, 460, 300, 430, 310, 460);
noStroke();
fill(255, 255, 255);
triangle(310, 460, 320, 430, 330, 460);
noStroke();
fill(255, 255, 255);
triangle(330, 460, 340, 430, 350, 460);
noStroke();
fill(255, 255, 255);
triangle(350, 460, 360, 430, 370, 460);
noStroke();
fill(255, 255, 255);
triangle(370, 460, 380, 430, 390, 460);
//top teeth
noStroke();
fill(255, 255, 255);
triangle(320, 335, 335, 300, 350, 335);
noStroke();
fill(255, 255, 255);
triangle(320, 335, 327, 360, 335, 335);
noStroke();
fill(255, 255, 255);
triangle(335, 335, 342, 360, 350, 335);
//bubbles
noStroke();
fill(255, 255, 255);
firstvariable=firstvariable+1*dir;
ellipse(225, firstvariable+1, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(235, firstvariable+20, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(255, firstvariable+10, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(265, firstvariable+1, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(275, firstvariable+20, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(285, firstvariable+.005, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(295, firstvariable+1, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(305, firstvariable+20, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(315, firstvariable+.0, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(325, firstvariable+1, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(335, firstvariable+20, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(345, firstvariable+.005, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(375, firstvariable+.005, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(405, firstvariable+20, 5, 5);
if (keyPressed == true) {
firstvariable=firstvariable+1*dir;
ellipse(225, firstvariable+1, 5, 5);
firstvariable=firstvariable+1*dir;
fill(153, 0, 0);
ellipse(235, firstvariable+20, 5, 5);
firstvariable=firstvariable+1*dir;
fill(153, 0, 0);
ellipse(255, firstvariable+10, 5, 5);
firstvariable=firstvariable+1*dir;
ellipse(325, firstvariable+1, 5, 5);
firstvariable=firstvariable+1*dir;
fill(153, 0, 0);
ellipse(335, firstvariable+20, 5, 5);
firstvariable=firstvariable+1*dir;
fill(153, 0, 0);
ellipse(345, firstvariable+.005, 5, 5);
}
//FALLING BLOOD
secondvariable=secondvariable+1*dir2;
fill(153, 0, 0);
ellipse( 235,secondvariable+20, 10, 10);
secondvariable=secondvariable+1*dir2;
fill(153, 0, 0);
ellipse( 255,secondvariable+1, 10, 10);
secondvariable=secondvariable+1*dir2;
fill(153, 0, 0);
ellipse( 275,secondvariable+40, 10, 10);
secondvariable=secondvariable+1*dir2;
fill(153, 0, 0);
ellipse( 295,secondvariable+30, 10, 10);
fill(0, 0, 0);
rect(mouseX + 10, 50, pmouseX, 10);
println(mouseX + ", " + mouseY);
fill(153, 0, 0);
}
WEEK 2 CODE









