Justin - Project 1

By Justin Chen
///Justin Chen ///DMA 28 interactivity ///project 1 ///Fall 2008 ///this is a program that reveals stories from different perspectives ////////////////////////////////////////////////////////////////////// int page = 0; float x = 0; float y = 0; float easing = 0.1; float maxDistance; PFont font; String direction; String letters = ""; PImage fish; PImage blackf; PImage jelly; PImage blackj; PImage star; PImage blacks; /////////////////////////////ALL OF THE BACKGROUND FILES//////////////////////////////// PImage next; PImage shell; PImage main; PImage p0; PImage p2; PImage starglow; PImage p3; PImage jg1; PImage jg2; PImage jg3; PImage jg4; PImage jg5; PImage jg6; PImage jg7; PImage jg8; PImage jg9; PImage jg10; PImage jg11; PImage jg12; PImage p4; PImage lfish; PImage p5; PImage heavy; int fall=100; PImage p6; PImage small; PImage group; PImage p7; PImage p8; PImage p9; PImage p10; PImage p11; PImage p12; PImage p13; PImage p14; PImage mfish; int left=550; PImage p122; PImage p123; PImage p15; PImage p16; PImage p17; PImage starfish; PImage p18; PImage couple; PImage babies; PImage p19; PImage p20; PImage starfly; PImage p21; PImage p22; PImage p23; PImage p24; PImage p25; PImage p26; int crWidth = 100; int crHeight = 100; int crX, crY; boolean overFish = false; int fishWidth = 100; int fishHeight = 40; int fishX = 50; int fishY = 150; boolean overJelly = false; int jellyWidth =40; int jellyHeight =150; int jellyX =250; int jellyY =100; boolean overStar = false; int starWidth =80; int starHeight =80; int starX = 400; int starY =100; boolean overBstar = false; int bstarWidth =100; int bstarHeight =100; int bstarX =420; int bstarY =70; void setup() { size(600, 400); frameRate (100); font = loadFont ("TrajanPro-Regular-30.vlw"); textFont (font); smooth(); maxDistance = dist(0, 0, width, height); } void draw() { /////////////////////////////TITLE PAGE////////////////////////////////////////////////// p0 = loadImage ("title.jpg"); background(p0); shell = loadImage ("main shell.png"); text("click on the shell", 370, 350); textSize(12); if (page == 0) { image(shell, 500, 300, 80, 80); ////////////////////////////MAIN PAGE WITH 3 STORY CHOICES///////////////////////////// } else if (page == 1) { main = loadImage ("main.jpg"); background(main); fill(0); textSize(14); text("press BACKSPACE key anytime",30, 300); text("to come back to this page", 30, 320); fish = loadImage("FISH.png"); blackf= loadImage("fish black.png"); jelly= loadImage("jelly.png"); blackj= loadImage("jelly black.png"); star= loadImage("star.png"); blacks= loadImage("star black.png"); int x = mouseX; int y = mouseY; crX = x - crWidth/2; crY = y - crHeight/2; image(fish, fishX, fishY); image(jelly, jellyX, jellyY); image(star, starX, starY); ///////////////DISPLAY BLACK IMAGE OF EACH CHARACTER WHEN CURSOR IS OVER//////////////// if (overFish == true) { image(blackf, 50, 150); } if (crX + crWidth > fishX && crX < fishX + fishWidth && crY + crHeight > fishY && crY < fishY + fishHeight) { overFish = true; overJelly = false; overStar = false; } else if (overStar == true) { image(blacks, 400, 100); } if (crX + crWidth > starX && crX < starX + starWidth && crY + crHeight > starY && crY < starY + starHeight) { overStar = true; overFish = false; overJelly =false; } else if (overJelly == true) { image(blackj, 250, 100); } if (crX + crWidth > jellyX && crX < jellyX + jellyWidth && crY + crHeight > jellyY && crY < jellyY + jellyHeight) { overJelly = true; overFish = false; overStar = false; } /////////////////////////////STAR'S INTRO PAGE////////////////////////////////////////// } else if (page == 2) { int y=0; p2 = loadImage ("p2.jpg"); background(p2); image (star, 420, 70); } /////////////////////////////JELLYFISH'S INTRO PAGE/////////////////////////////////// else if (page == 3) { p3 =loadImage ("jellygp.jpg"); next = loadImage("NEXT.jpg"); background(p3); fill(255); /////////////////////////////JELLY GROUP MOTION////////////////////////////////// jg1=loadImage("j12.jpg"); jg2=loadImage("j11.jpg"); jg3=loadImage("j10.jpg"); jg4=loadImage("j9.jpg"); jg5=loadImage("j8.jpg"); jg6=loadImage("j7.jpg"); jg7=loadImage("j6.jpg"); jg8=loadImage("j5.jpg"); jg9=loadImage("j4.jpg"); jg10=loadImage("j3.jpg"); jg11=loadImage("j2.jpg"); jg12=loadImage("j1.jpg"); if (mouseX <= 40) { image(jg1, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 40 && mouseX <= 70){ image(jg2, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 70 && mouseX <= 100){ image(jg3, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 100 && mouseX <= 120){ image(jg4, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 120 && mouseX <= 140){ image(jg5, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 140 && mouseX <= 160){ image(jg6, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 160 && mouseX <= 180){ image(jg7, 0, 0); text("(move cursor slowly from left to right)", 50, 250); textSize(14); } else if (mouseX > 180 && mouseX <= 200){ image(jg8, 0, 0); text("(move cursor slowly from left to right)", 250, 100); textSize(14); } else if (mouseX > 200 && mouseX <= 230){ image(jg9, 0, 0); text("(move cursor slowly from left to right)", 250, 100); textSize(14); } else if (mouseX > 230 && mouseX <= 250){ image(jg10, 0, 0); text("(move cursor slowly from left to right)", 250, 100); textSize(14); } else if (mouseX > 250 && mouseX <= 330){ image(jg11, 0, 0); text("(move cursor slowly from left to right)", 250, 100); textSize(14); } else if (mouseX > 330 && mouseX <= 600){ image(jg12, 0, 0); text("(move cursor slowly from left to right)", 250, 100); textSize(14); image(next,500, 350); } } ///////////////////////////FISH'S INTRO PAGE//////////////////////////////////////// else if (page == 4) { p4= loadImage ("p4.jpg"); background(p4); fill(255); text("(change fish's size by moving the cursor)", 110, 220); next =loadImage("NEXT.jpg"); image(next,500, 350); lfish = loadImage ("FISH enlarge.png"); float d = dist(width/2, height/2, mouseX, mouseY); image(lfish, mouseX, mouseY, d*1, d*1); } ///////////////////////STAR FALLS ///////////////////////////////////////// else if (page == 5) { p5 = loadImage ("p5.jpg"); background(p5); heavy = loadImage ("heavy.png"); image(heavy, 430, fall); fall = fall+5; next =loadImage("NEXT.jpg"); image(next,500, 350); } /////////////////////////////JELLY ESCAPE////////////////////////////////////////// else if (page == 6) { p6 = loadImage ("p6.jpg"); background(p6); small = loadImage ("smjelly.png"); group = loadImage ("jelly group.png"); image(small, 330, 230); image(group, 80, 80); image(next,500, 350); } /////////////////////////////FISH SEES LIGHT////////////////////////////////////////// else if (page == 7) { p7 = loadImage ("p7.jpg"); background(p7); text("(click on the light source)", 200, 150); } /////////////////////////////STAR CHOICES PAGE////////////////////////////////////////// else if (page == 8) { p8 = loadImage ("p8.jpg"); background(p8); } /////////////////////////////JELLY CHOICES PAGE////////////////////////////////////////// else if (page == 9) { p9 = loadImage ("p9.jpg"); background(p9); } /////////////////////////////FISH CHOICES PAGE////////////////////////////////////////// else if (page == 10) { p10 = loadImage ("p10.jpg"); background(p10); } /////////////////////////////STAR AND STAR////////////////////////////////////////// else if (page == 11) { p11 = loadImage ("p11.jpg"); background(p11); image(next,500, 350); } /////////////////////////////STAR AND JELLY////////////////////////////////////////// else if (page == 12) { p12 = loadImage ("p12.jpg"); background(p12); p122 = loadImage ("p12-2.jpg"); p123 = loadImage ("p12-3.jpg"); if (mouseX <= 300) { image(p123, 0, 0); text("(move cursor to the left)", 50, 370); image(next,500, 350); } else if (mouseX >300) { image(p122, 0, 0); text("(move cursor to the left)", 50, 370); image(next,500, 350); } } /////////////////////////////STAR AND FISH////////////////////////////////////////// else if (page == 13) { p13 = loadImage("p13.jpg"); background(p13); image(next,500, 350); } /////////////////////////////FISH AND JELLY PAGE////////////////////////////////////////// else if (page == 14) { p14 = loadImage("p14.jpg"); background(p14); mfish = loadImage("mfish.png"); next =loadImage("NEXT.jpg"); image(next,500, 350); image(mfish,left, 80); left = left-10; if (left == 250){ left= 260; } } /////////////////////////////JELLY AND JELLY PAGE////////////////////////////////////////// else if (page == 15) { p15 = loadImage ("p15.jpg"); background(p15); image(next,500, 350); } /////////////////////////////FISH AND ROCK PAGE////////////////////////////////////////// else if (page == 16) { p16 = loadImage ("p16.jpg"); background(p16); image(next,500, 350); } /////////////////////////////STAR END PAGE////////////////////////////////////////// else if (page == 17) { p17 = loadImage ("p17.jpg"); background(p17); starfish = loadImage ("starfish.png"); starfly = loadImage ("starfly.png"); float targetX = mouseX; float targetY = mouseY; x += (targetX - x) * easing; y += (targetY - y) * easing; image(starfish, mouseX, mouseY, 100, 100); image(starfly, x, y, 100, 100); fill(255); text("(press BACKSPACE key to reveal another story)", 250, 100); } /////////////////////////////JELLY END PAGE////////////////////////////////////////// else if (page == 18) { p18 = loadImage ("p18.jpg"); background(p18); couple= loadImage ("couple.png"); image(couple, mouseX, mouseY); babies= loadImage ("jellys.png"); if (mousePressed == false) { int ix= mouseX - babies.width/2; int iy= mouseY - babies.height/2; image(babies, ix, iy); } fill(255); text("(press BACKSPACE key to reveal another story)", 190, 200); } /////////////////////////////STAR AND JELLY PAGE////////////////////////////////////////// else if (page == 19) { p19= loadImage ("p19.jpg"); background(p19); image(next,500, 350); } /////////////////////////////STAR AND FISH END PAGE////////////////////////////////////////// else if (page == 20) { p20 = loadImage ("p20.jpg"); background(p20); starfly = loadImage ("starfly.png"); image(starfly, 260, fall+120); fall = fall-5; image(next,500, 350); } /////////////////////////////FISH END PAGE////////////////////////////////////////// else if (page == 21) { p21 = loadImage ("p21.jpg"); background(p21); fill(255); text("(press BACKSPACE key)", 20, 340); } /////////////////////////////STAR AND JELLY END PAGE////////////////////////////////////////// else if (page == 22) { p22 = loadImage ("p22.jpg"); background(p22); fill(255); text("(press BACKSPACE key)", 355, 210); } /////////////////////////////STAR AND FISH END PAGE////////////////////////////////////////// else if (page == 23) { p23 = loadImage ("p23.jpg"); background(p23); fill(255); text("(press BACKSPACE key to reveal another story)", 210, 360); } /////////////////////////////FISH END PAGE////////////////////////////////////////// else if (page == 24) { p24 = loadImage ("p24.jpg"); background(p24); fill(255); text("(press BACKSPACE key)", 430, 300); } /////////////////////////////FISH AND JELLY PAGE////////////////////////////////////////// else if (page == 25) { p25 = loadImage ("p25.jpg"); background(p25); mfish = loadImage("mfish.png"); next =loadImage("NEXT.jpg"); image(next,500, 350); image(mfish,left, 80); left = left-10; if (left == 250){ left= 260; } } /////////////////////////////JELLY END PAGE////////////////////////////////////////// else if (page == 26) { p26 =loadImage ("p26.jpg"); background(p26); fill(255); text("(press BACKSPACE key to reveal another story)", 140, 350); } } /////////////////////////////PROCEED TO NEXT PAGE//////////////////////////////////////// void mousePressed() { if ((page == 0) && (mouseX > 500) && (mouseX < 560) && (mouseY > 310) && (mouseY < 380)) { page = 1; } else if ((page == 1) && (mouseX > 450) && (mouseX < 550) && (mouseY > 130) && (mouseY < 300)) { page = 2; } else if ((page == 1) && (mouseX > 300) && (mouseX < 350) && (mouseY > 120) && (mouseY < 300)) { page = 3; } else if ((page == 1) && (mouseX > 40) && (mouseX < 180) && (mouseY > 150) && (mouseY < 250)) { page = 4; } else if ((page == 2) && (mouseX > 400) && (mouseX < 550) && (mouseY > 60) && (mouseY < 250)) { page = 5; } else if ((page == 3) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 6; } else if ((page == 4) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)){ page = 7; } else if ((page == 5) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 8; } else if ((page == 6) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 9; } else if ((page == 11) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 17; } else if ((page == 14) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 21; } else if ((page == 13) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 20; } else if ((page == 15) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 18; } else if ((page == 12) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 19; } else if ((page == 19) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 22; } else if ((page == 20) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 23; } else if ((page == 16) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 24; } else if ((page == 25) && (mouseX > 300) && (mouseX < 600) && (mouseY > 350) && (mouseY < 400)) { page = 26; } else if ((page == 7) && (mouseX > 90) && (mouseX < 130) && (mouseY > 140) && (mouseY < 180)) { page = 10; } } /////////////////////////////KEYS FOR DECISIONS////////////////////////////////////////// void keyPressed() { if ( key == BACKSPACE) { page = 1; } else if ((page == 9) && (key == '1')) { page = 12; } else if ((page == 9) && (key == '2')) { page = 25; } else if ((page == 9) && (key == '3')) { page = 15; } else if ((page == 10) && (key == '1')) { page = 14; } else if ((page == 10) && (key == '2')) { page = 13; } else if ((page == 10) && (key == '3')) { page = 16; } else if ((page == 8) && (key == '1')) { page = 12; } else if ((page == 8) && (key == '2')) { page = 13; } else if ((page == 8) && (key == '3')) { page = 11; } }

One Comment

  1. Posted November 4, 2008 at 2:04 pm | Permalink

    The story structure is fantastic. The idea of the same story told from multiple perspectives is not new, but it’s a good idea and done well here.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*