/* Title: "Houston, we have a problem." Artist: Adi Khanna Description: Help poor Houston The Astronaut evade the space turrets by moving him around with the mouse! Or betray him by clicking the mouse..." */ void setup() { size(400, 400); } void draw() { frameRate(60); background(0); noCursor(); //stars... colorMode(RGB, 400); strokeWeight(2); stroke(mouseX); point(160, 20); point(260, 60); point(220, 120); point(60, 140); point(40, 220); point(140, 380); point(260, 340); point(360, 180); point(200, 260); point(120, 180); colorMode(RGB, 255); strokeWeight(1); //Houston's backpack... stroke(0); strokeWeight(2); fill(139, 137, 137); rect(mouseX-40, mouseY-100, 80, 130); rect(mouseX-40, mouseY-120, 10, 20); fill(0); ellipse(mouseX-36, mouseY-115, 4, 4); //Houston's head... rectMode(CENTER); fill(255, 100, 0); ellipse(mouseX, mouseY-60, 60, 60); fill(0); rect(mouseX, mouseY-60, 52, 25); fill(255, 255, 255); //Houston's body... fill(255, 100, 0); rectMode(CORNER); rect(mouseX-40, mouseY-30, 80, 10); triangle(mouseX-40, mouseY-20, mouseX+40, mouseY-20, mouseX, mouseY+40); //Houston's badge... fill(0, 255, 255); rect(mouseX+10, mouseY-18, 20, 10); fill(173, 255, 47); triangle(mouseX+10, mouseY-8, mouseX+20, mouseY-18, mouseX+30, mouseY-9); //Houston's left arm... fill(255, 100, 0); rect(mouseX-80, mouseY-30, 40, 20); triangle(mouseX-40, mouseY-10, mouseX-40, mouseY-20, mouseX-33, mouseY-10); triangle(mouseX-80, mouseY-30, mouseX-80, mouseY-10, mouseX-100, mouseY-20); quad(mouseX-100, mouseY-20, mouseX-80, mouseY-10, mouseX-90, mouseY+20, mouseX-110, mouseY+10); arc(mouseX-101, mouseY+18, 22, 22, 0, 4.01426); //Houston's right arm... rect(mouseX+40, mouseY-30, 40, 20); triangle(mouseX+40, mouseY-10, mouseX+40, mouseY-20, mouseX+33, mouseY-10); fill(255, 100, 0); triangle(mouseX+80, mouseY-30, mouseX+80, mouseY-10, mouseX+100, mouseY-20); quad(mouseX+100, mouseY-20, mouseX+80, mouseY-10, mouseX+90, mouseY+20, mouseX+110, mouseY+10); arc(mouseX+101, mouseY+18, 22, 22, -0.698132, 2.96706); //Houston's left leg... quad(mouseX-14, mouseY+20, mouseX, mouseY+40, mouseX-20, mouseY+68, mouseX-40, mouseY+50); triangle(mouseX-40, mouseY+50, mouseX-40, mouseY+68, mouseX-20, mouseY+68); rect(mouseX-40, mouseY+68, 20, 40); arc(mouseX-30, mouseY+108, 20, 40, 0, 3.14159); arc(mouseX-30, mouseY+108, 20, 20, 0, 3.14159); //Houston's right leg... quad(mouseX+14, mouseY+20, mouseX, mouseY+40, mouseX+20, mouseY+68, mouseX+40, mouseY+50); triangle(mouseX+40, mouseY+50, mouseX+40, mouseY+68, mouseX+20, mouseY+68); rect(mouseX+20, mouseY+68, 20, 40); arc(mouseX+30, mouseY+108, 20, 40, 0, 3.14159); arc(mouseX+30, mouseY+108, 20, 20, 0, 3.14159); fill(255, 255, 255); strokeWeight(1); //top left turret... fill(255, 0, 0); rect(0, 0, 60, 60); fill(200, 0, 0); rect(20, 20, 20, 20); stroke(255, 0, 0); line(60, 60, 80, 80); line(60, 30, 80, 30); line(30, 60, 30, 80); stroke(0); //top right turret... fill(255, 0, 0); rect(340, 0, 60, 60); fill(200, 0, 0); rect(360, 20, 20, 20); stroke(255, 0, 0); line(340, 60, 320, 80); line(340, 30, 320, 30); line(370, 60, 370, 80); stroke(0); //bottom left turret... fill(255, 0, 0); rect(0, 340, 60, 60); fill(200, 0, 0); rect(20, 360, 20, 20); stroke(255, 0, 0); line(60, 340, 80, 320); line(30, 340, 30, 320); line(60, 370, 80, 370); stroke(0); //bottom right turret... fill(255, 0, 0); rect(340, 340, 60, 60); fill(200, 0, 0); rect(360, 360, 20, 20); stroke(255, 0, 0); line(340, 340, 320, 320); line(340, 370, 320, 370); line(370, 340, 370, 320); stroke(0); fill(255, 255, 255); } void mousePressed() { frameRate(3); //Houston's raised right arm... stroke(0); strokeWeight(2); fill(255, 100, 0); quad(mouseX+80, mouseY-30, mouseX+80, mouseY-60, mouseX+100, mouseY-60, mouseX+100, mouseY-20); arc(mouseX+90, mouseY-60, 20, 20, -3.14159, 0); fill(255, 255, 255); //Houston's help sign... rect(mouseX+50, mouseY-110, 90, 40); //Letter H... line(mouseX+60, mouseY-100, mouseX+60, mouseY-80); line(mouseX+60, mouseY-90, mouseX+70, mouseY-90); line(mouseX+70, mouseY-100, mouseX+70, mouseY-80); //Letter E... line(mouseX+80, mouseY-100, mouseX+80, mouseY-80); line(mouseX+80, mouseY-100, mouseX+90, mouseY-100); line(mouseX+80, mouseY-90, mouseX+90, mouseY-90); line(mouseX+80, mouseY-80, mouseX+90, mouseY-80); //Letter L... line(mouseX+100, mouseY-100, mouseX+100, mouseY-80); line(mouseX+100, mouseY-80, mouseX+110, mouseY-80); //Letter P... line(mouseX+120, mouseY-100, mouseX+120, mouseY-80); line(mouseX+120, mouseY-100, mouseX+130, mouseY-100); line(mouseX+130, mouseY-100, mouseX+130, mouseY-90); line(mouseX+120, mouseY-90, mouseX+130, mouseY-90); //Make the lower half of Houston's right arm invisible when he raises the help sign... strokeWeight(1); fill(0); quad(mouseX+100, mouseY-20, mouseX+80, mouseY-10, mouseX+90, mouseY+20, mouseX+110, mouseY+10); arc(mouseX+101, mouseY+18, 22, 22, -0.698132, 2.96706); fill(255, 255, 255); //Cracks on Houston's suit... strokeWeight(3); stroke(255, 0, 0); //Crack #1... stroke(105, 105, 105); line(mouseX-35, mouseY-95, mouseX-28, mouseY-90); line(mouseX-35, mouseY-90, mouseX-28, mouseY-95); //Crack #2... stroke(255, 50, 0); line(mouseX-10, mouseY-42, mouseX-3, mouseY-37); line(mouseX-10, mouseY-37, mouseX-3, mouseY-42); //Crack #3... stroke(105, 105, 105); line(mouseX+35, mouseY-42, mouseX+28, mouseY-37); line(mouseX+35, mouseY-37, mouseX+28, mouseY-42); //Crack #4... stroke(255, 50, 0); line(mouseX-20, mouseY-10, mouseX-13, mouseY-5); line(mouseX-20, mouseY-5, mouseX-13, mouseY-10); //Crack #5... line(mouseX+10, mouseY+5, mouseX+17, mouseY+10); line(mouseX+10, mouseY+10, mouseX+17, mouseY+5); stroke(105, 105, 105); //Crack #6... line(mouseX-30, mouseY+20, mouseX-23, mouseY+25); line(mouseX-30, mouseY+25, mouseX-23, mouseY+20); stroke(255, 50, 0); //Crack #7... line(mouseX-60, mouseY-25, mouseX-53, mouseY-20); line(mouseX-60, mouseY-20, mouseX-53, mouseY-25); //Crack #8... line(mouseX-100, mouseY+2, mouseX-93, mouseY+7); line(mouseX-100, mouseY+7, mouseX-93, mouseY+2); //Crack #9... line(mouseX+90, mouseY-50, mouseX+97, mouseY-45); line(mouseX+90, mouseY-45, mouseX+97, mouseY-50); //Crack #10... line(mouseX+83, mouseY-40, mouseX+90, mouseY-35); line(mouseX+83, mouseY-35, mouseX+90, mouseY-40); //Crack #11... line(mouseX-15, mouseY+40, mouseX-22, mouseY+45); line(mouseX-15, mouseY+45, mouseX-22, mouseY+40); //Crack #12... line(mouseX+27, mouseY+80, mouseX+34, mouseY+85); line(mouseX+27, mouseY+85, mouseX+34, mouseY+80); strokeWeight(1); stroke(255, 255, 0); fill(255, 255, 0); //top left bullets firing diagonally... ellipse(90, 90, 5, 5); ellipse(100, 100, 5, 5); ellipse(110, 110, 5, 5); //top left bullets firing right... ellipse(90, 30, 5, 5); ellipse(100, 30, 5, 5); ellipse(110, 30, 5, 5); //top left bullets firing down... ellipse(30, 90, 5, 5); ellipse(30, 100, 5, 5); ellipse(30, 110, 5, 5); //top right bullets firing diagonally... ellipse(310, 90, 5, 5); ellipse(300, 100, 5, 5); ellipse(290, 110, 5, 5); //top right bullets firing left... ellipse(310, 30, 5, 5); ellipse(300, 30, 5, 5); ellipse(290, 30, 5, 5); //top right bullets firing down... ellipse(370, 90, 5, 5); ellipse(370, 100, 5, 5); ellipse(370, 110, 5, 5); //bottom left bullets firing diagonally... ellipse(90, 310, 5, 5); ellipse(100, 300, 5, 5); ellipse(110, 290, 5, 5); //bottom left bullets firing right... ellipse(90, 370, 5, 5); ellipse(100, 370, 5, 5); ellipse(110, 370, 5, 5); //bottom left bullets firing up... ellipse(30, 310, 5, 5); ellipse(30, 300, 5, 5); ellipse(30, 290, 5, 5); //bottom right bullets firing diagonally... ellipse(310, 310, 5, 5); ellipse(300, 300, 5, 5); ellipse(290, 290, 5, 5); //bottom right bullets firing left... ellipse(310, 370, 5, 5); ellipse(300, 370, 5, 5); ellipse(290, 370, 5, 5); //bottom right bullets firing up... ellipse(370, 310, 5, 5); ellipse(370, 300, 5, 5); ellipse(370, 290, 5, 5); //Conceal Houstons's lower right arm beneath the turrets by adding more turret layers: //second layer of top left turret... stroke(0); fill(255, 0, 0); rect(0, 0, 60, 60); fill(200, 0, 0); rect(20, 20, 20, 20); stroke(255, 0, 0); line(60, 60, 80, 80); line(60, 30, 80, 30); line(30, 60, 30, 80); stroke(0); //second layer of top right turret... fill(255, 0, 0); rect(340, 0, 60, 60); fill(200, 0, 0); rect(360, 20, 20, 20); stroke(255, 0, 0); line(340, 60, 320, 80); line(340, 30, 320, 30); line(370, 60, 370, 80); stroke(0); //second layer of bottom left turret... fill(255, 0, 0); rect(0, 340, 60, 60); fill(200, 0, 0); rect(20, 360, 20, 20); stroke(255, 0, 0); line(60, 340, 80, 320); line(30, 340, 30, 320); line(60, 370, 80, 370); stroke(0); //second layer of bottom right turret... fill(255, 0, 0); rect(340, 340, 60, 60); fill(200, 0, 0); rect(360, 360, 20, 20); stroke(255, 0, 0); line(340, 340, 320, 320); line(340, 370, 320, 370); line(370, 340, 370, 320); stroke(0); }