Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//--------------PROG ASSIGNMENT 1---------------//
//---------------ALEXANDER KEHN----------------//
//---------------id# 991368989----------------//
//---"Untitled Programming Assignment 1"-----//
//-------------------OR---------------------//
//------"How I Learned to Stop Worrying----//
//-----------and Write Some Code"---------//

void setup () {
  size(400, 400);
}

void draw() {
  noStroke();
  noCursor();

  //--------------THE MAIN DRAWING--------------//
  frameRate(60); //set frameRate to allow for mousePressed trick
  background(206, 241, 158); //gameboy green lightest
  fill(57, 134, 137); //gameboy green dark
  rect(0, 160, 400, 240); //foreground

  //CLOUDS
  fill(230, 241, 180); //much lighter green
  rect(120+frameCount*0.8, 120, 80, 40, 7);
  rect(33+frameCount, 100, 80, 30, 7);
  rect(-300+frameCount*0.8, 20, 80, 40, 7);
  rect(-300+frameCount, 40, 80, 40, 7);
  rect(-800+frameCount*0.9, 100, 80, 40, 7);
  rect(-800+frameCount, 110, 80, 40, 7);
  
  //PYRAMIDS IN HORIZON, MOUSE XY MAKES THEM WIGGLE
  fill(120, 190, 151); //gbgreen mid
  triangle(360+mouseX*0.1, 100-mouseY*0.1, 400, 160, 320, 160);
  fill(167, 221, 167); //gbgreen mid-lightest
  triangle(360+mouseX*0.1, 100-mouseY*0.1, 380, 160, 320, 160);

  fill(167, 221, 167); //gbgreen mid-light
  triangle(280+mouseX*0.1, 80-mouseY*0.1, 320, 160, 220, 160);
  fill(120, 190, 151); //gbgreen mid
  triangle(280+mouseX*0.1, 80-mouseY*0.1, 360, 160, 320, 160);


  //THE LAKE
  fill(167, 221, 167); //gbgreen mid-light
  ellipseMode(CORNER);
  ellipse(200, 200, 200, 60);
  ellipse(145, 238, 489, 105);
  ellipse(282, 332, 145, 35);
  ellipseMode(CENTER);
  ellipse(260, 343, 10, 5);
  rect(312, 200, 100, 160);

  //TOADSTOOL
  fill(230, 241, 180); //gbgreen much lighter
  ellipse(90, 312, 60, 30); //rounds the base
  rect(60, 300, 60, 20, 7); //base
  fill(11, 71, 109); //gbgreen darkest
  triangle(82, 255, 91, 281, 42, 284); //left slope of cap
  triangle(98, 254, 137, 282, 96, 273); //right slope of cap
  ellipseMode(CORNER);
  ellipse(78, 252, 25, 25); //fills the point of the cap
  ellipse(40, 270, 100, 40); //fills the bottom of cap

  //--------------THE FISHING DUDE--------------//

  //LOWER TORSO
  fill(120, 190, 151); //gbgreen mid
  rect(60, 220, 65, 40, 7);
  ellipseMode(CENTER);
  ellipse(60, 240, 40, 40);

  //UPPER TORSO
  triangle(80, 140, 80, 240, 50, 240);
  rect(80, 140, 40, 80);
  triangle(140, 140, 125, 230, 80, 140);

  //HEAD
  ellipse(110, 135, 60, 65);

  //MOUTH
  fill(11, 71, 109); //gbgreen darkest
  ellipse(108, 136, 20, 20); //left cheek
  ellipse(130, 138, 15, 15); //right cheek
  rect(110, 131, 21, 15, 2); //fills out mouth
  ellipse(118, 140, 36, 20); //this circle helps form the smile (lower lip)
  fill(120, 190, 151); //change back to torso color
  ellipse(123, 124, 18, 16); //this circle helps form the smile (upper lip)

  //TEETH
  fill(230, 241, 180); //gbgreen lightest
  noStroke();
  rect(108, 126, 5, 5, 2);
  rect(124, 145, 5, 5, 2);

  //LEGS
  noFill();
  stroke(120, 190, 151); //gbgreen mid
  strokeWeight(10);
  bezier(68, 250, 99, 280, 79, 300, 78+(sin(frameCount/6))*5, 310+(sin(frameCount/6))*5);
  bezier(114, 250, 143, 269, 122, 287, 126+(sin(frameCount/6))*5, 300+(sin(frameCount/6))*5);

  //EYE SHAFT
  stroke(240, 255, 235); //gbgreen lightest
  strokeWeight(10); //set weight large, shaft is just a bezier
  noFill();
  bezier(120+(sin(frameCount*0.1))*3, 80, 122+(sin(frameCount*0.1))*3, 100, 105+(sin(frameCount*0.1))*3, 85+(sin(frameCount*0.1))*3, 113, 106);
  bezier(140+(sin(frameCount*0.1))*3, 81, 139+(sin(frameCount*0.1))*3, 107, 128+(sin(frameCount*0.1))*3, 86+(sin(frameCount*0.1))*3, 123, 107); 

  //LEFT EYEBALL
  noStroke();
  fill(240, 255, 235); //gbg lightest
  ellipse(120+(sin(frameCount*0.1))*3, 70, 14, 20);//left eyball, sine of frameCount creates oscillation
  fill(11, 71, 109); //gbgreen dark for pupil
  ellipse(120+(sin(frameCount*0.1))*3, 70, 7, 10); //pupil
  fill(240, 255, 235); //gbgreen lightest for pupil
  triangle(120+(sin(frameCount*0.1))*3, 70, 125+(sin(frameCount*0.1))*3, 65, 120+(sin(frameCount*0.1))*3, 65); //cartoony notch out of pupil

  //RIGHT EYEBALL
  fill(240, 255, 235); //gbgreen lightest
  ellipse(140+(sin(frameCount*0.1))*3, 75, 14, 20);//left eyball, sin stuff makes it wobble
  fill(11, 71, 109); //set color dark for pupil
  ellipse(140+(sin(frameCount*0.1))*3, 75, 7, 10); //pupil
  fill(240, 255, 235); //back to lightest for pupil
  triangle(140+(sin(frameCount*0.1))*3, 77, 146+(sin(frameCount*0.1))*3, 71, 140+(sin(frameCount*0.1))*3, 69); //cartoony notch out of pupil

  //--------------FISH SILHOUETTE----------//
  //needs to be below FISHING ROD and RIGHT ARM for proper layering!
  fill(120, 190, 151); //gbgreen mid
  noStroke();
  ellipse(340+(sin(frameCount*0.05)*80), 280+(sin(frameCount*0.01)*30), 60+(sin(mouseX*0.1)*10), 15);
  //--------------------------------------//
  
  //RIGHT ARM
  stroke(120, 190, 151); //gbg mid
  strokeWeight(10);
  line(130, 185, mouseX, mouseY);

  //--------------FISHING ROD--------------//
  //needs to be between ARMS for proper layering!
  noStroke();
  fill(11, 71, 109); //gbg dark
  triangle(mouseX-20, mouseY+20, mouseX+20, mouseY-80, mouseX-10, mouseY+20);
  triangle(mouseX+20, mouseY-80, mouseX+60, mouseY-140, mouseX+25, mouseY-80);
  triangle(mouseX+5, mouseY-40, mouseX+20, mouseY-80, mouseX+25, mouseY-80);
  rect(mouseX-18, mouseY+20, 8, 50);

  //FISHING LINE
  stroke(11, 71, 109);
  strokeWeight(2);
  line(mouseX+60, mouseY-140, 340+(sin(frameCount*0.05)*80), 280+(sin(frameCount*0.01)*30));
  //----------------------------------------//
  
  //LEFT ARM
  stroke(120, 190, 151); //gbg mid
  strokeWeight(10);
  line(70, 210, mouseX-10, mouseY+20);
  //-----------END OF MAIN PICTURE----------//


  //------------OPENING THE MOUTH-----------//
  //UPPER TEETH
  noStroke();

  fill(255, 249, 203);
  rect(60, 200 - mouseX, 60, 60, 7);
  fill(255);
  rect(40, 200 - mouseX, 60, 60, 7);

  fill(255, 249, 203);
  rect(300, 200 - mouseX, 60, 60, 7);
  fill(255);
  rect(280, 200 - mouseX, 60, 60, 7);

  //BOTTOM TOOTH
  fill(255, 249, 203);
  rect(150, 160 + mouseX, 60, 60, 7);
  fill(255);
  rect(130, 160 + mouseX, 60, 60, 7);

  //UPPER MOUTH
  fill(255, 215, 0); //sunset yellow-ish
  rect(0, 0, 400, 200 - mouseX*0.90);

  //UPPER LIPS
  noStroke();
  fill(200, 200, 0); //ugly green
  rect(0, 160 - mouseX*0.9, 400, 40 + mouseX*0.1);

  //BOTTOM MOUTH
  fill(255, 215, 0); //yellow again
  rect(0, 200 + mouseX*0.85, 400, 200);

  //BOTTOM LIPS
  fill(200, 230, 0); //ugly green a bit greener for highlight
  rect(0, 200 + mouseX*0.85, 400, 40 + mouseX*0.2);

  //PIMPLES
  stroke(199, 96, 88); //darkish pink
  strokeWeight(10);
  point(350, 360 + mouseX);
  point(100, 120 - mouseX);

  //CHIN AND NOSTRIL LINES
  stroke(255, 178, 72);
  strokeWeight(3);
  noFill();
  curve(95, 140 + mouseX, 95, 260 + mouseX, 200, 265 + mouseX, 220, 125 + mouseX);
  curve(220, 125 + mouseX, 200, 265 + mouseX, 300, 260 + mouseX, 220, 125 + mouseX);
  line(160, 80 - mouseX, 160, 160 - mouseX);
  line(240, 80 - mouseX, 240, 160 - mouseX);
}
//--------------END OF MOUTH TOWN---------------//

//-------------MOUSEPRESSED CHANGES------------//
void mousePressed() {

  frameRate(0.5);

  background(194, 150, 232);
  noStroke();
  fill(255, 104, 134);
  rect(0, 160, 400, 240); //foreground

  //PYRAMIDS
  fill(255, 246, 0);
  triangle(360, 100, 400, 160, 320, 160);
  fill(255, 192, 0);
  triangle(360, 100, 380, 160, 320, 160);

  fill(255, 192, 0);
  triangle(280, 80, 320, 160, 220, 160);
  fill(255, 246, 0);
  triangle(280, 80, 360, 160, 320, 160);

  //LAKE
  fill(85, 213, 107);
  ellipseMode(CORNER);
  ellipse(200, 200, 200, 60);
  ellipse(145, 238, 489, 105);
  ellipse(282, 332, 145, 35);
  ellipseMode(CENTER);
  ellipse(260, 343, 10, 5);
  rect(312, 200, 100, 160);

  //TOADSTOOL
  fill(255);
  ellipse(90, 312, 60, 30); //rounds the base
  rect(60, 300, 60, 20, 7); //base
  fill(181, 85, 213);
  triangle(82, 255, 91, 281, 42, 284); //left slope of cap
  triangle(98, 254, 137, 282, 96, 273); //right slope of cap
  ellipseMode(CORNER);
  ellipse(78, 252, 25, 25); //fills the point of the cap
  ellipse(40, 270, 100, 40); //fills the bottom of cap

  //----------FISH DUDE---------//
  //LOWER TORSO
  fill(53, 255, 248);
  rect(60, 220, 65, 40, 7);
  ellipseMode(CENTER);
  ellipse(60, 240, 40, 40);

  //UPPER TORSO
  triangle(41, 140, 124, 225, 50, 240);
  triangle(101, 144, 125, 227, 39, 140);

  //HEAD
  ellipse(70, 135, 60, 65);

  //MOUTH
  fill(0);
  ellipse(66, 136, 20, 20); //left cheek
  ellipse(90, 138, 15, 15); //right cheek
  rect(69, 131, 21, 15, 2); //fills out mouth
  ellipse(77, 140, 36, 20); //this circle helps form the smile (lower lip)
  fill(93, 255, 248); //change back to torso color
  ellipse(81, 124, 18, 16); //this circle helps form the smile (upper lip)

  //TEETH

  fill(255);
  noStroke();
  rect(64, 126, 5, 5, 2);
  rect(84, 145, 5, 5, 2);

  //LEGS
  noFill();
  stroke(53, 255, 248);
  strokeWeight(10);
  bezier(68, 250, 99, 280, 79, 300, 78+(sin(frameCount/6))*5, 310+(sin(frameCount/6))*5);
  bezier(114, 250, 143, 269, 122, 287, 126+(sin(frameCount/6))*5, 300+(sin(frameCount/6))*5);

  //EYE SHAFT
  stroke(255);
  strokeWeight(10);
  noFill();
  bezier(120+(sin(frameCount*0.1))*3, 77, 121+(sin(frameCount*0.1))*3, 99, 89+(sin(frameCount*0.1))*3, 68+(sin(frameCount*0.1))*3, 71, 110);
  strokeWeight(10);
  bezier(140+(sin(frameCount*0.1))*3, 81, 132+(sin(frameCount*0.1))*3, 138, 109+(sin(frameCount*0.1))*3, 86+(sin(frameCount*0.1))*3, 85, 109); 
  
  //LEFT EYEBALL
  noStroke();
  fill(255);
  ellipse(120+(sin(frameCount*0.1))*3, 70, 14, 20);//left eyball, sin stuff makes it wobble
  fill(0); //set color to black for pupil
  ellipse(120+(sin(frameCount*0.1))*3, 70, 7, 10); //pupil
  fill(255); //set to white for pupil
  triangle(120+(sin(frameCount*0.1))*3, 70, 125+(sin(frameCount*0.1))*3, 65, 120+(sin(frameCount*0.1))*3, 65); //cartoony notch out of pupil

  //RIGHT EYEBALL
  fill(255);
  ellipse(140+(sin(frameCount*0.1))*3, 75, 14, 20);//left eyball, sin stuff makes it wobble
  fill(0); //set color to black for pupil
  ellipse(140+(sin(frameCount*0.1))*3, 75, 7, 10); //pupil
  fill(255); //set to white for pupil
  triangle(140+(sin(frameCount*0.1))*3, 77, 146+(sin(frameCount*0.1))*3, 71, 140+(sin(frameCount*0.1))*3, 69); //cartoony notch out of pupil

  //RIGHT ARM
  stroke(53, 255, 248);
  strokeWeight(10);
  line(87, 183, 151, 177);

  //----------FISHING ROD---------//
  noStroke();
  fill(160, 132, 0);
  triangle(140, 180, 180, 80, 150, 180);
  triangle(180, 80, 220, 20, 190, 80);
  triangle(160, 140, 180, 80, 190, 80);
  rect(140, 180, 8, 50);

  noFill();
  stroke(0);
  strokeWeight(2);
  bezier(220, 20, 235, 164, 288, -21, 294, 111);

  //LEFT ARM
  stroke(53, 255, 248);
  strokeWeight(10);
  line(70, 210, 145, 200);
  //------------END OF FISHDUDE------------------//

  //----------------GAMEBOY---------------------//
  noStroke();
  fill(187, 239, 82, 166); //OUTER GLOW...STUPID?
  ellipse(290, 160, 105, 140);

  fill(226, 216, 207);//light gray
  rect(250, 105, 80, 120, 7); //main body
  fill(139, 132, 132); //darker grey
  rect(260, 115, 60, 40); //screen border
  fill(23, 240, 2); //green
  rect(270, 120, 40, 30); //screen
  fill(255, 0, 0); //red
  ellipse(265, 126, 2, 2); //indicator light

  fill(0); //black for dpad
  rect(266, 167, 8, 20);//dpad x
  rect(260, 173, 20, 8);//dpad y

  fill(229, 42, 103); //pink
  ellipse(301, 178, 10, 10); //B button
  ellipse(314, 172, 10, 10); //A button
  //----------END OF GAMEBOY---------//


  //--------RADICAL--------//
  //SPEECH BUBBLE
  fill(255, 246, 0); //yellow from pyramids
  ellipse(320, 360, 217, 153);
  triangle(140, 400, 220, 360, 256, 400);
  triangle(87, 345, 247, 342, 251, 390);
  triangle(247, 372, 159, 284, 258, 325);
  triangle(199, 249, 276, 310, 241, 340);
  triangle(263, 295, 250, 254, 285, 292);
  triangle(287, 343, 278, 261, 304, 291);
  triangle(296, 290, 307, 250, 356, 305);
  triangle(326, 317, 350, 261, 360, 303);
  triangle(353, 293, 390, 220, 406, 319);

  //LETTERS
  //R
  fill(229, 42, 103);//pink
  triangle(233, 390, 214, 310, 242, 300);
  triangle(265, 382, 224, 345, 249, 344);
  rect(225, 310, 20, 39);
  triangle(236, 302, 287, 283, 244, 351);

  //A
  triangle(270, 380, 300, 290, 310, 320);
  triangle(330, 380, 290, 320, 300, 290);
  rect(286, 344, 28, 10);

  //D
  triangle(339, 385, 325, 285, 378, 340);

  // !
  triangle(382, 370, 382, 304, 400, 301);
  ellipse(382, 376, 10, 5);
}