////////////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // // // Spider-Man swinging // // Swing with Spidey! Press any key to take a flash photo of Spiderman for the Daily Bugle! // // Click to turn on lights in the windows! // // By: Baker Albach // 991 481 993 // // This project was inspired by Punk Pitfall and the recently released Spiderman PS4 game // // // // ////////////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ void setup() { size(400,400); rectMode(CENTER); noCursor(); // removed cursor }; void draw() { // sky colour changes with mouseX background((mouseX/400.0*255), 0, 204); frameRate(60); // Sun moves with mouseY noStroke(); fill(255,222,0); ellipse(width/2 + 100, mouseY*0.55, 50, 50); stroke(0); strokeWeight(2); // bg brown building (1) fill(164,94,32); rect(mouseX*-0.60 + 80, height/2, 70, 350); // windows fill(200); rect(mouseX*-0.60 + 63, height/2 - 150, 20, 20); rect(mouseX*-0.60 + 98, height/2 - 150, 20, 20); rect(mouseX*-0.60 + 63, height/2 - 100, 20, 20); rect(mouseX*-0.60 + 98, height/2 - 100, 20, 20); rect(mouseX*-0.60 + 63, height/2 - 50, 20, 20); rect(mouseX*-0.60 + 98, height/2 - 50, 20, 20); rect(mouseX*-0.60 + 63, height/2, 20, 20); rect(mouseX*-0.60 + 98, height/2, 20, 20); rect(mouseX*-0.60 + 63, height/2 + 50, 20, 20); rect(mouseX*-0.60 + 98, height/2 + 50, 20, 20); rect(mouseX*-0.60 + 63, height/2 + 100, 20, 20); rect(mouseX*-0.60 + 98, height/2 + 100, 20, 20); // bg empire state building fill(150); rect(mouseX*-0.45 + 475, height/2 - 130, 15, 85); rect(mouseX*-0.45 + 475, height/2 + 50, 85, 275); rect(mouseX*-0.45 + 475, height/2 + 85, 105, 275); rect(mouseX*-0.45 + 475, height/2 + 110, 125, 275); // windows fill(200); rect(mouseX*-0.45 + 429, height/2 + 190, 20, 45); rect(mouseX*-0.45 + 475.5, height/2 + 190, 20, 45); rect(mouseX*-0.45 + 520, height/2 + 190, 20, 45); rect(mouseX*-0.45 + 429, height/2 + 130, 20, 45); rect(mouseX*-0.45 + 475.5, height/2 + 130, 20, 45); rect(mouseX*-0.45 + 520, height/2 + 130, 20, 45); rect(mouseX*-0.45 + 429, height/2 + 70, 20, 45); rect(mouseX*-0.45 + 475.5, height/2 + 70, 20, 45); rect(mouseX*-0.45 + 520, height/2 + 70, 20, 45); rect(mouseX*-0.45 + 429, height/2 + 10, 20, 45); rect(mouseX*-0.45 + 475.5, height/2 + 10, 20, 45); rect(mouseX*-0.45 + 520, height/2 + 10, 20, 45); // more bg buildings (2) fill(130); rect(mouseX*-0.75 + 200, height/2 + 20, 130, 250); // windows fill(200); rect(mouseX*-0.75 + 160, height/2 - 75, 25, 25); rect(mouseX*-0.75 + 200, height/2 - 75, 25, 25); rect(mouseX*-0.75 + 240, height/2 - 75, 25, 25); rect(mouseX*-0.75 + 160, height/2 - 40, 25, 25); rect(mouseX*-0.75 + 200, height/2 - 40, 25, 25); rect(mouseX*-0.75 + 240, height/2 - 40, 25, 25); rect(mouseX*-0.75 + 160, height/2 - 5, 25, 25); rect(mouseX*-0.75 + 200, height/2 - 5, 25, 25); rect(mouseX*-0.75 + 240, height/2 - 5, 25, 25); rect(mouseX*-0.75 + 160, height/2 + 30, 25, 25); rect(mouseX*-0.75 + 200, height/2 + 30, 25, 25); rect(mouseX*-0.75 + 240, height/2 + 30, 25, 25); rect(mouseX*-0.75 + 160, height/2 + 65, 25, 25); rect(mouseX*-0.75 + 200, height/2 + 65, 25, 25); rect(mouseX*-0.75 + 240, height/2 + 65, 25, 25); // building spidey is swinging from (3) fill(184,124,52); rect(width/2 + mouseX*-0.65 + 130, height/2 - 30, 105, 300); // windows fill(200); rect(width/2 + mouseX*-0.65 + 105, height/2 + 90, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 + 90, 30, 30); rect(width/2 + mouseX*-0.65 + 105, height/2 + 30, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 + 30, 30, 30); rect(width/2 + mouseX*-0.65 + 105, height/2 - 30, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 - 30, 30, 30); rect(width/2 + mouseX*-0.65 + 105, height/2 - 90, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 - 90, 30, 30); rect(width/2 + mouseX*-0.65 + 105, height/2 - 150, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 - 150, 30, 30); ////////////////////////////////////////////////SPIDER MAN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // web stroke(215); strokeWeight(3); line(width/2 + mouseX*-0.65 + 130, 50, mouseX, mouseY); // back arm (holding web) stroke(0); strokeWeight(1.3); fill(255,0,0); rect(mouseX-1, mouseY+10, 9, 35); // hand (follows cursor) fill(255,0,0); rect(mouseX-1, mouseY-2, 9, 9); // more back arm fill(0,0,255); rect(mouseX-14, mouseY+23, 35, 9); // body (blue) rect(mouseX-35, mouseY+35, 26, 40); // red body fill(255,0,0); rect(mouseX-30, mouseY+35, 15, 40); // spider emblem fill(0); ellipse(mouseX-29.5, mouseY+32, 7, 11); rect(mouseX-30, mouseY+30, 12, 1.5); rect(mouseX-30, mouseY+34, 12, 1.5); rect(mouseX-26.5, mouseY+32, 1.5, 15); rect(mouseX-31.5, mouseY+32, 1.5, 15); // head strokeWeight(2); fill(255,0,0); ellipse(mouseX-33, mouseY-1, 25, 35); fill(255); ellipse(mouseX-27, mouseY-3, 7, 14); strokeWeight(1.3); // other arm fill(0,0,255); quad(mouseX-38, mouseY+28, mouseX-47, mouseY+23, mouseX-70, mouseY+55, mouseX-61, mouseY+60); fill(255,0,0); quad(mouseX-70, mouseY+55, mouseX-61, mouseY+60, mouseX-55, mouseY+90, mouseX-65, mouseY+90); rect(mouseX-59.5, mouseY+95, 10.5, 10); fill(0,0,255); // legs (back then front) quad(mouseX-46, mouseY+64, mouseX-31, mouseY+58, mouseX-24, mouseY+88, mouseX-33, mouseY+100); quad(mouseX-25, mouseY+78, mouseX-25, mouseY+54.5, mouseX, mouseY+72, mouseX-10, mouseY+82); fill(255,0,0); quad(mouseX+15, mouseY+95.5, mouseX+17, mouseY+89, mouseX, mouseY+72, mouseX-10, mouseY+82); quad(mouseX-37, mouseY+120, mouseX-21, mouseY+106, mouseX-24, mouseY+88, mouseX-47, mouseY+124); //feet quad(mouseX-40, mouseY+120, mouseX-38, mouseY+129, mouseX-40, mouseY+140, mouseX-52, mouseY+121); quad(mouseX+12, mouseY+97, mouseX+12, mouseY+100, mouseX+35, mouseY+100, mouseX+19, mouseY+87); // spideybutt (this line of code was readapted from Punk Pitfall to make the ) fill(0,0,255); arc(mouseX-22, mouseY+56, 50, 45, HALF_PI, PI); ///////////////////////////////////////////////END OF SPIDERMAN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // foreground building stroke(0); strokeWeight(2); fill(175); rect(mouseX*-1.25 + 350, height/2 + 180, 500, 250); // foreground windows fill(200); rect(mouseX*-1.25 + 200, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 300, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 400, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 500, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 200, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 300, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 400, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 500, height/2 + 220, 50, 50); } /////////////////////////////// Turn on lights in the windows when the mouse is pressed \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ void mousePressed(){ // yellow lights in the windows fill(254,224,53); //Building 1 rect(mouseX*-0.60 + 63, height/2 - 150, 20, 20); rect(mouseX*-0.60 + 98, height/2 - 100, 20, 20); rect(mouseX*-0.60 + 63, height/2 - 50, 20, 20); rect(mouseX*-0.60 + 98, height/2, 20, 20); rect(mouseX*-0.60 + 63, height/2 + 50, 20, 20); rect(mouseX*-0.60 + 98, height/2 + 100, 20, 20); // Empire State Building rect(mouseX*-0.45 + 429, height/2 + 190, 20, 45); rect(mouseX*-0.45 + 520, height/2 + 190, 20, 45); rect(mouseX*-0.45 + 475.5, height/2 + 130, 20, 45); rect(mouseX*-0.45 + 429, height/2 + 70, 20, 45); rect(mouseX*-0.45 + 520, height/2 + 70, 20, 45); rect(mouseX*-0.45 + 475.5, height/2 + 10, 20, 45); // Building 2 fill(254,224,53); rect(mouseX*-0.75 + 160, height/2 - 75, 25, 25); rect(mouseX*-0.75 + 240, height/2 - 75, 25, 25); rect(mouseX*-0.75 + 200, height/2 - 40, 25, 25); rect(mouseX*-0.75 + 160, height/2 - 5, 25, 25); rect(mouseX*-0.75 + 240, height/2 - 5, 25, 25); rect(mouseX*-0.75 + 200, height/2 + 30, 25, 25); rect(mouseX*-0.75 + 160, height/2 + 65, 25, 25); rect(mouseX*-0.75 + 240, height/2 + 65, 25, 25); rect(width/2 + mouseX*-0.65 + 155, height/2 + 90, 30, 30); rect(width/2 + mouseX*-0.65 + 105, height/2 + 30, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 - 30, 30, 30); rect(width/2 + mouseX*-0.65 + 105, height/2 - 90, 30, 30); rect(width/2 + mouseX*-0.65 + 155, height/2 - 150, 30, 30); // redrawing spiderman over the lit windows ////////////////////////////////////////////////SPIDER MAN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // web stroke(215); strokeWeight(3); line(width/2 + mouseX*-0.65 + 130, 50, mouseX, mouseY); // back arm (holding web) stroke(0); strokeWeight(1.3); fill(255,0,0); rect(mouseX-1, mouseY+10, 9, 35); // hand (follows cursor) fill(255,0,0); rect(mouseX-1, mouseY-2, 9, 9); // more back arm fill(0,0,255); rect(mouseX-14, mouseY+23, 35, 9); // body (blue) rect(mouseX-35, mouseY+35, 26, 40); // red body fill(255,0,0); rect(mouseX-30, mouseY+35, 15, 40); // spider emblem fill(0); ellipse(mouseX-29.5, mouseY+32, 7, 11); rect(mouseX-30, mouseY+30, 12, 1.5); rect(mouseX-30, mouseY+34, 12, 1.5); rect(mouseX-26.5, mouseY+32, 1.5, 15); rect(mouseX-31.5, mouseY+32, 1.5, 15); // head strokeWeight(2); fill(255,0,0); ellipse(mouseX-33, mouseY-1, 25, 35); fill(255); ellipse(mouseX-27, mouseY-3, 7, 14); strokeWeight(1.3); // other arm fill(0,0,255); quad(mouseX-38, mouseY+28, mouseX-47, mouseY+23, mouseX-70, mouseY+55, mouseX-61, mouseY+60); fill(255,0,0); quad(mouseX-70, mouseY+55, mouseX-61, mouseY+60, mouseX-55, mouseY+90, mouseX-65, mouseY+90); rect(mouseX-59.5, mouseY+95, 10.5, 10); fill(0,0,255); // legs (back then front) quad(mouseX-46, mouseY+64, mouseX-31, mouseY+58, mouseX-24, mouseY+88, mouseX-33, mouseY+100); quad(mouseX-25, mouseY+78, mouseX-25, mouseY+54.5, mouseX, mouseY+72, mouseX-10, mouseY+82); fill(255,0,0); quad(mouseX+15, mouseY+95.5, mouseX+17, mouseY+89, mouseX, mouseY+72, mouseX-10, mouseY+82); quad(mouseX-37, mouseY+120, mouseX-21, mouseY+106, mouseX-24, mouseY+88, mouseX-47, mouseY+124); //feet quad(mouseX-40, mouseY+120, mouseX-38, mouseY+129, mouseX-40, mouseY+140, mouseX-52, mouseY+121); quad(mouseX+12, mouseY+97, mouseX+12, mouseY+100, mouseX+35, mouseY+100, mouseX+19, mouseY+87); // spideybutt fill(0,0,255); arc(mouseX-22, mouseY+56, 50, 45, HALF_PI, PI); ///////////////////////////////////////////////END OF SPIDERMAN\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // Foreground Building redrawn to appear in front of lit windows stroke(0); strokeWeight(2); fill(175); rect(mouseX*-1.25 + 350, height/2 + 180, 500, 250); fill(200); rect(mouseX*-1.25 + 200, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 300, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 400, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 500, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 200, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 300, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 400, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 500, height/2 + 220, 50, 50); fill(254,224,53); rect(mouseX*-1.25 + 200, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 400, height/2 + 130, 50, 50); rect(mouseX*-1.25 + 300, height/2 + 220, 50, 50); rect(mouseX*-1.25 + 500, height/2 + 220, 50, 50); frameRate(1); }; void keyPressed(){ // Camera flash to take a photo of Spidey while swinging noStroke(); fill(255,210,0,50); rect(0,0,800,800); // prints text when key is pressed println("JJJ is gonna love this one!"); };