/*Chihuahua wants a treat by Marseilaise Perkins Your pet chihuahua wants a treat. He performs the trick beg. He will follow your mouse from left to right begging for the treat. When you left-click the mouse button you give him a treat. */ void setup() { //this is the size that the window will be set in. size(400,400); } void draw() { //the backgorund is set to one color, which is a bright aqua blue. background(157, 253, 255); rectMode(CENTER); fill(81, 185, 99); noStroke(); rect(200, 400, 500, 250); smooth(5); noStroke(); /*the sun stays in place. Moving the cursor around the top of the window will change the suns color from a bright yellow to a orange. */ //SUN\\ fill(250+(mouseX), 150+(mouseY),0); noStroke(); ellipse(360, 40, 45, 45); //the clouds stay on the same point on the Y-axis but move on the X-axis at a speed of .2 //CLOUDS\\ fill(255, 254, 224); noStroke(); ellipse(310+(mouseX-310)*.2, 68, 30, 30); ellipse(305+(mouseX-310)*.2, 35, 40, 40); ellipse(330+(mouseX-310)*.2, 50, 45, 45); ellipse(278+(mouseX-310)*.2, 45, 50, 35); ellipse(289+(mouseX-310)*.2, 60, 30, 30); ellipse(289+(mouseX-310)*.2, 35, 30, 30); ellipse(50+(mouseX-310)*.2, 125, 60, 30); ellipse(64+(mouseX-310)*.2, 119, 34,40); ellipse(70+(mouseX-310)*.2, 119, 30, 20); ellipse(55+(mouseX-310)*.2, 112, 30, 20); ellipse(70+(mouseX-310)*.2, 130, 40, 20); // this is the dog treats bag. The bag does not move. The dog treat bag is included as a visual. //DOGGIE TREATS BAG\\ fill(150, 175, 158); quad(290, 210, 300, 200, 380, 200, 370, 210); fill(123, 147, 130); quad(300, 220, 290, 210, 370, 210, 380, 220); fill(150, 175, 158); quad(275, 290, 300, 220, 380, 220, 365, 290); fill(123, 147, 130); rect(320, 300, 91, 20); fill(102, 118, 107); quad(365, 290, 365, 310, 385, 300, 385, 285); fill(110, 126, 110); triangle(380, 220, 365, 290, 385, 285); fill(110, 126, 115); triangle(370, 210, 375, 210, 380, 220); fill(110, 126, 110); triangle(380, 200, 370, 210, 375, 210); //this is included ot help the user know that the bag is indeed a dogs treat bag //DOGGIE TREATS BAG BONE COVER\\ fill(255, 246, 229); noStroke(); quad(325, 237, 335, 237, 320, 270, 310, 270); ellipse(336, 235, 12, 12); ellipse(324, 235, 12, 12); ellipse(310, 270, 12, 12); ellipse(320, 270, 12, 12); /* this is the tail of the dog. The tail does not move because the dog sits in one place. The tail is used as a visual. */ //TAIL\\ fill(216, 183, 116); triangle(240, 241, 220, 250, 220, 278); triangle(241, 238, 232, 252, 229, 248); /* like the tail of the dog the back legs also do not move but are included as a visual. the back of the legs are covered by the front of the legs. */ //LEGS (BACK OF LEGS)\\ fill(216, 194, 133); triangle(220, 265, 240, 250, 211, 295); triangle(185, 265, 165, 255, 190, 295); // this is the front of the back legs. Included as a visual to show the dog is sitting. //LEGS(FRONT OF THE BACK LEGS)\\ fill(240, 201, 123); quad(180, 260, 167, 255.5, 170, 290, 190, 290); quad(238, 250, 220, 255, 215, 290, 225, 290); /* the body of the dog is made up of 9 different sized ellipses each moving at a different pace, depending on how close the ellipses are to the head and the bottom. The closer to the head the fast the ellipses move. The closer to the bottom the ellipses ares slower to make the dog look as if he is moving from side to side. The ellipses move in a parabola like formation by the given code of " X+(mouseX-X)*0, Y+abs(mouseX-Y)*0 ". This creats the formation. */ //BODY\\ fill(232, 197, 126); ellipse(200+(mouseX-200)*.08, 202+abs(mouseX-202)*.08, 32, 42); ellipse(200+(mouseX-200)*.07, 210+abs(mouseX-204)*.07, 36, 46); ellipse(200+(mouseX-200)*.06, 218+abs(mouseX-206)*.06, 40, 50); ellipse(200+(mouseX-200)*.05, 228+abs(mouseX-208)*.05, 40, 50); ellipse(200+(mouseX-200)*.04, 236+abs(mouseX-210)*.04, 40, 50); ellipse(200+(mouseX-200)*.03, 244+abs(mouseX-212)*.03, 42, 52); ellipse(200+(mouseX-200)*.02, 252+abs(mouseX-214)*.02, 44, 54); ellipse(200+(mouseX-200)*.01, 260+abs(mouseX-216)*.01, 46, 56); ellipse(200+(mouseX-200)*0, 268+abs(mouseX-218)*0, 48, 58); /*the paws are put after the body so that the paws are seen in front of the body. The paws do not move but are used for a visual. */ //BACK LEGS PAWS\\ fill(245, 206, 129); ellipse(180, 290, 25, 15); ellipse(215, 290, 25, 15); fill(0); //this is used to represent the individual pads of the dog. //BACK LEGS PAWS TOES\\ stroke(2); line(210, 292, 210, 296); line(215, 292, 215, 297); line(220, 292, 220, 296); line(185, 292, 185, 296); line(180, 292, 180, 297); line(175, 292, 175, 296); /*The dogs paws are put up to his chest to signify he is begging. The paws move left to right with the body. Also the paws, liekt eh body, follow the mouse from side to side */ //RIGHT PAW\\ stroke(2); line(210+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 210+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(200+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(200+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 202+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(202+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(208+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 210+(mouseX-200)*.09, 214+abs(mouseX-150)*.09); line(202+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 202+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); line(205+(mouseX-200)*.09, 213+abs(mouseX-150)*.09, 205+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(208+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); // the left paw does what the right paw does except is moved off a few points. //left paw stroke(2); line(185+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 185+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(185+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 187+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(187+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 192+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(192+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 195+(mouseX-200)*.09, 214+abs(mouseX-150)*.09); line(195+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 195+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(187+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 187+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); line(193+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 193+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); line(190+(mouseX-200)*.09, 213+abs(mouseX-150)*.09, 190+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); //The ears move from side ot side with the entire body of the dog. //RIGHT EAR\\ fill(232, 197, 126); noStroke(); triangle(210+(mouseX-200)*.09, 60+abs(mouseX-150)*.09, 210+(mouseX-200)*.09, 120+abs(mouseX-150)*.09, 230+(mouseX-200)*.09, 120+abs(mouseX-150)*.09); //This is the inside of the dogs ears. fill(242, 198, 198); noStroke(); triangle (212+(mouseX-200)*.09, 70+abs(mouseX-150)*.09, 212+(mouseX-200)*.09, 138+abs(mouseX-150)*.09, 225+(mouseX-200)*.09, 115+abs(mouseX-150)*.09); //This is for the left ear. It follows the body and does what the right ear does. //LEFT EAR\\ fill(232, 197, 126); noStroke(); triangle(190+(mouseX-200)*.09, 60+abs(mouseX-150)*.09, 170+(mouseX-200)*.09, 120+abs(mouseX-150)*.09, 190+(mouseX-200)*.09, 120+abs(mouseX-150)*.09) ; //This is the inside of the dogs ears. fill(242, 198, 198); noStroke(); triangle (188+(mouseX-200)*.09, 70+abs(mouseX-150)*.09, 172+(mouseX-200)*.09, 118+abs(mouseX-150)*.09, 185+(mouseX-200)*.09, 150+abs(mouseX-150)*.09); /*This is the head of the dog. This ellipse moves faster than the body of the dog and moves from side to side in a parabola formation. The head is made up of two different circles to show the shadow underneath the chin. */ //HEAD\\ fill(216, 184, 118); noStroke();; ellipse(200+(mouseX-200)*.09, 150+abs(mouseX-150)*.09, 80, 90); fill(232, 197, 126); noStroke(); ellipse(200+(mouseX-200)*.09, 146.5+abs(mouseX-150)*.09, 79, 80); //This is the brown spot found on the top of the dogs head //SPOT\\ fill(90, 75, 43); triangle(191+(mouseX-200)*.09, 106+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 105+abs(mouseX-150)*.09, 190+(mouseX-200)*.09, 120+abs(mouseX-150)*.09) ; /*This is the outter white of the dogs eyes. This moves with the dogs body and head. The outter eye is white to help make the eyes look more cartoony. */ //OUUTER EYES\\ fill(255); ellipse(180+(mouseX-200)*.09, 145+abs(mouseX-150)*.09, 13, 20); ellipse (220+(mouseX-200)*.09, 145+abs(mouseX-150)*.09, 13, 20); /*The inner eye is the pupils of the dogs. They are coloured black to visually show the dogs pupils are black. The pupils move with the dog and the outter eyes. */ //INNER EYES\\ fill(0); ellipse(180+(mouseX-200)*.09, 143+abs(mouseX-150)*.09, 13, 17); ellipse(220+(mouseX-200)*.09, 143+abs(mouseX-150)*.09, 13, 17); //this is to show where the light source is coming from. //EYE SPARKLE\\ fill(255); ellipse(184+(mouseX-200)*.09, 140+abs(mouseX-150)*.09, 5, 5); fill(255); ellipse(224+(mouseX-200)*.09, 140+abs(mouseX-150)*.09, 5, 5); /* The nose is a triangle to show simple shape, or cartoony shape, of an acutal dogs nose. Also moves with the body of the dog. */ //NOSE\\ fill(0); triangle(192+(mouseX-200)*.09, 150+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 150+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 159+abs(mouseX-150)*.09) ; //The mouth is in the style of a simple dog mouth. The mouth moves with the dogs body as well. //MOUTH\\ stroke(1); fill(0); //left side of mouth line(200+(mouseX-200)*.09, 162+abs(mouseX-150)*.09, 197+(mouseX-200)*.09, 165+abs(mouseX-150)*.09) ; line(197+(mouseX-200)*.09, 165+abs(mouseX-150)*.09, 192+(mouseX-200)*.09, 162+abs(mouseX-150)*.09) ; //right side of mouth line(200+(mouseX-200)*.09, 159+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 162+abs(mouseX-150)*.09) ; line(200+(mouseX-200)*.09, 162+abs(mouseX-150)*.09, 203+(mouseX-200)*.09, 165+abs(mouseX-150)*.09); line(203+(mouseX-200)*.09, 165+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 162+abs(mouseX-150)*.09); //The Grass moves to show as if it was swaying in the wind. The grass is in different colors and different heights. //Grass right side fill(78, 162, 62); noStroke(); arc(393, 390, 40+(mouseX-400)*.02, 400+(mouseY-300)*.02, 39, 60, 300); fill(79, 173, 61); noStroke(); arc(375, 350, 20+(mouseX-370)*.02, 200+(mouseY)*.02, 80, 90, 330); fill(43, 134, 26); noStroke(); arc(385, 380, 15+(mouseX-390)*.02, 300+(mouseY-300)*.02, 33, 50, 300); fill(51, 116, 39); noStroke(); arc(390, 380, 5+(mouseX-35)*.02, 200+(mouseY-400)*.02, 33, 52, 300); //Grass left side fill(57, 149, 39); noStroke(); arc(25, 350, 20+(mouseX-0)*.02, 200+(mouseY-600)*.02, 30, 300, 300); fill(51, 116, 39); noStroke(); arc(15, 340, 15+(mouseX-10)*.02, 300+(mouseY-600)*.02, 33, 380, 320); fill(43, 134, 26); noStroke(); arc(5, 400, 20+(mouseX-20)*.02, 320+(mouseY-320)*.02, 70, 500, 300); } //This signifies the events that occur when the left button of the mouse is pressed. void mousePressed() { frameRate(60); smooth(5); //body fill(232, 197, 126); noStroke(); ellipse(200+(mouseX-200)*.08, 202+abs(mouseX-202)*.08, 32, 42); ellipse(200+(mouseX-200)*.07, 210+abs(mouseX-204)*.07, 36, 46); ellipse(200+(mouseX-200)*.06, 218+abs(mouseX-206)*.06, 40, 50); ellipse(200+(mouseX-200)*.05, 228+abs(mouseX-208)*.05, 40, 50); ellipse(200+(mouseX-200)*.04, 236+abs(mouseX-210)*.04, 40, 50); ellipse(200+(mouseX-200)*.03, 244+abs(mouseX-212)*.03, 42, 52); ellipse(200+(mouseX-200)*.02, 252+abs(mouseX-214)*.02, 44, 54); ellipse(200+(mouseX-200)*.01, 260+abs(mouseX-216)*.01, 46, 56); ellipse(200+(mouseX-200)*0, 268+abs(mouseX-218)*0, 48, 58); /*back legs and paws, ears, head, eyes are included so that when the left button is clicked the objects do not suddenly disappear. */ //back legs paws fill(245, 206, 129); ellipse(180, 290, 25, 15); ellipse(215, 290, 25, 15); fill(0); stroke(2); line(210, 292, 210, 296); line(215, 292, 215, 297); line(220, 292, 220, 296); line(185, 292, 185, 296); line(180, 292, 180, 297); line(175, 292, 175, 296); // right paw stroke(2); line(210+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 210+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(200+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(200+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 202+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(202+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(208+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 210+(mouseX-200)*.09, 214+abs(mouseX-150)*.09); line(202+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 202+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); line(205+(mouseX-200)*.09, 213+abs(mouseX-150)*.09, 205+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(208+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); //left paw stroke(2); line(185+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 185+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(185+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 187+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(187+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 192+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); line(192+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 195+(mouseX-200)*.09, 214+abs(mouseX-150)*.09); line(195+(mouseX-200)*.09, 214+abs(mouseX-150)*.09, 195+(mouseX-200)*.09, 210+abs(mouseX-150)*.09); line(187+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 187+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); line(193+(mouseX-200)*.09, 216+abs(mouseX-150)*.09, 193+(mouseX-200)*.09, 213+abs(mouseX-150)*.09); line(190+(mouseX-200)*.09, 213+abs(mouseX-150)*.09, 190+(mouseX-200)*.09, 216+abs(mouseX-150)*.09); //right ear fill(232, 197, 126); noStroke(); triangle(210+(mouseX-200)*.09, 60+abs(mouseX-150)*.09, 210+(mouseX-200)*.09, 120+abs(mouseX-150)*.09, 230+(mouseX-200)*.09, 120+abs(mouseX-150)*.09); fill(242, 198, 198); noStroke(); triangle (212+(mouseX-200)*.09, 70+abs(mouseX-150)*.09, 212+(mouseX-200)*.09, 138+abs(mouseX-150)*.09, 225+(mouseX-200)*.09, 115+abs(mouseX-150)*.09); //left ear fill(232, 197, 126); noStroke(); triangle(190+(mouseX-200)*.09, 60+abs(mouseX-150)*.09, 170+(mouseX-200)*.09, 120+abs(mouseX-150)*.09, 190+(mouseX-200)*.09, 120+abs(mouseX-150)*.09) ; fill(242, 198, 198); noStroke(); triangle (188+(mouseX-200)*.09, 70+abs(mouseX-150)*.09, 172+(mouseX-200)*.09, 118+abs(mouseX-150)*.09, 185+(mouseX-200)*.09, 150+abs(mouseX-150)*.09); //head fill(216, 184, 118); noStroke();; ellipse(200+(mouseX-200)*.09, 150+abs(mouseX-150)*.09, 80, 90); fill(232, 197, 126); noStroke(); ellipse(200+(mouseX-200)*.09, 146.5+abs(mouseX-150)*.09, 79, 80); //spot fill(90, 75, 43); triangle(191+(mouseX-200)*.09, 106+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 105+abs(mouseX-150)*.09, 190+(mouseX-200)*.09, 120+abs(mouseX-150)*.09) ; //outter eyes fill(255); ellipse(180+(mouseX-200)*.09, 145+abs(mouseX-150)*.09, 13, 20); ellipse (220+(mouseX-200)*.09, 145+abs(mouseX-150)*.09, 13, 20); //inner eyes fill(0); ellipse(180+(mouseX-200)*.09, 143+abs(mouseX-150)*.09, 13, 17); ellipse(220+(mouseX-200)*.09, 143+abs(mouseX-150)*.09, 13, 17); //eye sparkle fill(255); ellipse(184+(mouseX-200)*.09, 140+abs(mouseX-150)*.09, 5, 5); fill(255); ellipse(224+(mouseX-200)*.09, 140+abs(mouseX-150)*.09, 5, 5); //nose fill(0); triangle(192+(mouseX-200)*.09, 150+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 150+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 159+abs(mouseX-150)*.09) ; /*The bone is in the dogs mouth because when you click you are giving the dog his treat. He has it in his mouth because he wants to eat it. */ //BONE\\ fill(255, 246, 229); noStroke(); rect(200+(mouseX-200)*.09, 168+abs(mouseX-150)*.09, 40, 10); ellipse(225+(mouseX-200)*.09, 173+abs(mouseX-150)*.09, 12, 12); ellipse(225+(mouseX-200)*.09, 165+abs(mouseX-150)*.09, 12, 12); ellipse(175+(mouseX-200)*.09, 165+abs(mouseX-150)*.09, 12, 12); ellipse(175+(mouseX-200)*.09, 173+abs(mouseX-150)*.09, 12, 12); //mouth stroke(1); fill(0); //left side of mouth line(200+(mouseX-200)*.09, 162+abs(mouseX-150)*.09, 197+(mouseX-200)*.09, 165+abs(mouseX-150)*.09) ; line(197+(mouseX-200)*.09, 165+abs(mouseX-150)*.09, 192+(mouseX-200)*.09, 162+abs(mouseX-150)*.09) ; //right side of mouth line(200+(mouseX-200)*.09, 159+abs(mouseX-150)*.09, 200+(mouseX-200)*.09, 162+abs(mouseX-150)*.09) ; line(200+(mouseX-200)*.09, 162+abs(mouseX-150)*.09, 203+(mouseX-200)*.09, 165+abs(mouseX-150)*.09); line(203+(mouseX-200)*.09, 165+abs(mouseX-150)*.09, 208+(mouseX-200)*.09, 162+abs(mouseX-150)*.09); }