Colorize Me

By eloral

/* Nyx and Rhea just want to bring color to their black and white world! Help them out! Just follow the directions on screen and have fun! Sorry if there are bugs. =\ */ int page=1; float fally=0; float fallx=0; float fall1x=0; float fall1y=0; float slugcount=0; //3 slugs float yellx=0; float yelly=0; float yell1y=0; float yell1x=0; float parasiteX; float parasiteY; int selectedRed = 0; int selectedGreen = 0; int selectedBlue = 0; int selectedAlpha = 0; //pages PImage p00; PImage p01; PImage p02; PImage p03; PImage p04; PImage p04_black; PImage p04_lights; PImage p05; PImage p06; PImage p06_cry; PImage p07; PImage p08; PImage p08_win; PImage p08_lose; PImage p09; PImage p10; PImage p11; PImage p12; PImage p13; PImage p14; PImage p14_win; PImage p15; PImage p16; PImage p17_lose1; PImage p17_lose2; PImage p18; PImage p19; PImage p20; PImage p20_game; PImage p21; PImage p22; PImage p23; PImage p24; PImage p25; PImage p26_ins; PImage p26_game; PImage p26_lose; PImage p27; PImage p28; PImage p29; PImage p30; PImage p31; PImage p32; PImage p33; PImage p34; //pieces PImage rhea08; PImage monster1_08; PImage monster2_08; PImage grayugly_20; PImage parasite_11_23; PImage slug_20; PImage star_20; void setup(){ size(600,400); p00=loadImage("00_01.jpg"); p01=loadImage("01.jpg"); p02=loadImage("02.jpg"); p03=loadImage("03.jpg"); p04=loadImage("04.jpg"); p04_black=loadImage("black_02.png"); p04_lights=loadImage("04_things.jpg"); p05=loadImage("05.jpg"); p06=loadImage("06.jpg"); p06_cry=loadImage("28.jpg"); p07=loadImage("07.jpg"); p08=loadImage("08_plain.jpg"); p08_win=loadImage("08_02.jpg"); p08_lose=loadImage("08_01.jpg"); p09=loadImage("09.jpg"); p10=loadImage("10.jpg"); p11=loadImage("11.jpg"); p12=loadImage("12.jpg"); p13=loadImage("13.jpg"); p14=loadImage("14.jpg"); p14_win=loadImage("14_02.jpg"); p15=loadImage("15.jpg"); p16=loadImage("16.jpg"); p17_lose1=loadImage("17.jpg"); p17_lose2=loadImage("17_2.jpg"); p18=loadImage("18.jpg"); p19=loadImage("19.jpg"); p20=loadImage("ugh20.jpg"); p20_game=loadImage("20_game.jpg"); p21=loadImage("21.jpg"); p22=loadImage("22.jpg"); p23=loadImage("23.jpg"); p24=loadImage("24.jpg"); p25=loadImage("25.jpg"); p26_ins=loadImage("26.jpg"); p26_game=loadImage("26_plain.jpg"); p26_lose=loadImage("26_fail.jpg"); p27=loadImage("27.jpg"); p28=loadImage("29.jpg"); p29=loadImage("03_01.jpg"); p30=loadImage("03_02.jpg"); p31=loadImage("05_01.jpg"); p32=loadImage("05_02.jpg"); p33=loadImage("18_01.jpg"); p34=loadImage("18_02.jpg"); rhea08=loadImage("smallrhea.png"); monster1_08=loadImage("monster01.png"); monster2_08=loadImage("monster02.png"); grayugly_20=loadImage("grayuglysmall.png"); parasite_11_23=loadImage("parasitesmall.png"); slug_20=loadImage("slugsmall.png"); star_20=loadImage("starsmall.png"); //making parasite start off in a random place parasiteX=random(0,600); parasiteY=random(0,400); } void draw(){ println(page); if (page==1){ image(p00,0,0); }else if (page==2){ image(p01,0,0); }else if (page==3){ image(p02,0,0); }else if (page==4){ image(p03,0,0); }else if (page==5){ image(p04,0,0); }else if (page==6){ background(p04_lights); image(p04_black, mouseX-p04_black.width*0.5, mouseY-p04_black.height*0.5); }else if (page==7){ image(p05,0,0); }else if (page==8){ image(p06,0,0); }else if (page==9){ image(p06_cry,0,0); }else if (page==10){ image(p07,0,0); }else if (page==11){ image(p08,0,0); noCursor(); image(rhea08, mouseX-rhea08.width/2, mouseY-rhea08.height/2); Yellow01(); Yellow02(); Yellow01(); Yellow02(); float d = dist(mouseX, mouseY, 554, 72); if ((d<20)){ page=12; } }else if (page==12){ cursor(ARROW); image(p08_win,0,0); }else if (page==13){ cursor(ARROW); image(p08_lose,0,0); }else if (page==14){ cursor(ARROW); image(p09,0,0); }else if (page==15){ cursor(ARROW); image(p10,0,0); }else if (page==16){ image(p11,0,0); background(p23); //first number is how much/fast you move to the left, right number is how much/fast to the right parasiteX += random(-6,6); parasiteY += random(-6,6); //have to put the variable in there that you're constraining parasiteX = constrain(parasiteX, 0,600); parasiteY = constrain(parasiteY, 0,400); image(parasite_11_23, parasiteX - 0.5 * parasite_11_23.width ,parasiteY - 0.5 * parasite_11_23.height); //setting the center of the image fill(selectedRed, selectedGreen, selectedBlue, selectedAlpha); noStroke(); ellipse(mouseX, mouseY, 200,200); float d = dist(mouseX, mouseY, parasiteX, parasiteY); if ((d < 20) && ((selectedRed == 102) && (selectedGreen == 244) && (selectedBlue == 64))){ page = 17; } }else if (page==17){ image(p12,0,0); }else if (page==18){ image(p13,0,0); }else if (page==19){ image(p14,0,0); }else if (page==20){ image(p14_win,0,0); }else if (page==21){ image(p15,0,0); }else if (page==22){ image(p16,0,0); }else if (page==23){ image(p17_lose1,0,0); }else if (page==24){ image(p17_lose2,0,0); }else if (page==25){ image(p18,0,0); }else if (page==26){ image(p19,0,0); }else if (page==27){ image(p20,0,0); }else if(page==28){ image(p20_game,0,0); float mx = constrain(mouseX,0,600); float my = constrain(mouseY,302,395); noCursor(); image(star_20, mouseX-star_20.width/2, 350-star_20.height/2); Fall(); Slug(); }else if(page==29){ cursor(ARROW); image(p21,0,0); }else if(page==30){ image(p22,0,0); }else if (page==31){ background(p23); //first number is how much/fast you move to the left, right number is how much/fast to the right parasiteX += random(-6,6); parasiteY += random(-6,6); //have to put the variable in there that you're constraining parasiteX = constrain(parasiteX, 0,600); parasiteY = constrain(parasiteY, 0,400); image(parasite_11_23, parasiteX - 0.5 * parasite_11_23.width ,parasiteY - 0.5 * parasite_11_23.height); //setting the center of the image fill(selectedRed, selectedGreen, selectedBlue, selectedAlpha); noStroke(); ellipse(mouseX, mouseY, 200,200); float d = dist(mouseX, mouseY, parasiteX, parasiteY); if ((d < 20) && ((selectedRed == 243) && (selectedGreen == 109) && (selectedBlue == 1))){ page = 32; } /*center point fill(255, 0, 0); ellipse(200, 200, 10, 10); println(d);*/ //catching the monster; if the distance is 20 px from the center of the monster you win }else if(page==32){ image(p24,0,0); }else if(page==33){ image(p25,0,0); }else if(page==34){ image(p26_ins,0,0); }else if (page==35){ image(p26_game,0,0); /* //ARROWS string code=""; if(keyCode == uprightdownleft){ code += "uprightdownleft"; } {page = next page; }*/ }else if(page==36){ image(p26_lose,0,0); }else if(page==37){ image(p27,0,0); }else if(page==38){ image(p28,0,0); }else if(page==39){ image(p29,0,0); }else if(page==40){ image(p30,0,0); } else if(page==41){ image(p31,0,0); } else if(page==42){ image(p32,0,0); } else if(page==43){ image(p33,0,0); } else if(page==44){ image(p34,0,0); } } //create new functions for separate actions //set variables fally (falling from the top) and fallx (random position have these things fall from 0 to 600) // the += is the speed of it //the if fally>401 it goes past size 400 and then afterwards a new one starts to fall //the distance function takes (the position of the star, fallx, fally) //this measures the distance between the star and then the falling objects //(distance<90) says that within 90 px then something will happen when these 2 things hit void Yellow01(){ if(yelly == 0){ yellx = random(0,600); } image(monster1_08, yellx, yelly); yelly += 2; if(yelly > 405){ yelly=0; } float distance=dist(mouseX, mouseY, yellx, yelly); if(distance<90){ page=13; } } void Yellow02(){ if(yell1y == 0){ yell1y = random(0,600); } image(monster2_08, yell1x, yell1y); yell1y += 3; if (yell1y >405){ yell1y=0; } float distance=dist(mouseX, mouseY, yell1x, yell1y); if (distance<90){ page=13; } } void Fall(){ if(fally == 0){ fallx=random(0,600); } image(grayugly_20, fallx, fally); fally += 5; if(fally > 401){ fally=0; } float distance=dist(mouseX-star_20.width/2, 350-star_20.height/2,fallx,fally); if(distance<90){//put //within 90 pix of the star page=38; } } void Slug(){ if(fall1y == 0){ fall1x=random(0,600); } image(slug_20, fall1x, fall1y); fall1y += 3; if(fall1y > 401){ fall1y=0; } float distance=dist(mouseX-star_20.width/2, 350-star_20.height/2,fall1x,fall1y); if(distance<90){//put //within 90 pix of the star slugcount ++; //everytime you catch a slug fall1y = 0; } /*if(slugcount=1){//can put little counter images*/ if(slugcount==3){ slugcount=0; //makes the slugcount reset to 0 if you ever go back to this page page=29; } } void keyPressed(){ if (page == 1){ if (key == ENTER){ page = 2; } } if (page == 23){ if ((key == 't')||(key == 'T')){ page = 1; } } if (page == 24){ if ((key == 't')||(key == 'T')){ page = 1; } } if (key == 'o') { selectedRed = 243; selectedGreen = 109; selectedBlue = 1; selectedAlpha = 90; } else if (key == 'b') { selectedRed = 0; selectedGreen = 0; selectedBlue = 255; selectedAlpha = 90; } else if (key == 'r'){ selectedRed = 255; selectedGreen = 0; selectedBlue = 0; selectedAlpha = 90; } else if (key == 'g'){ selectedRed = 102; selectedGreen = 244; selectedBlue = 64; selectedAlpha = 90; } else if (key == 'y'){ selectedRed = 255; selectedGreen = 185; selectedBlue = 15; selectedAlpha = 90; } } void mouseMoved(){ if (((page == 4) || (page == 40)&&(mouseX >90)&&(mouseX <=233)&&(mouseY>86)&&(mouseY<=326))){ page = 39; } else if ((page == 4) || (page == 39)&&(mouseX>395)&&(mouseX<=506)&&(mouseY>86)&&(mouseY<326)){ page = 40; } else if ((page == 5)&&(mouseX>377)&&(mouseX<420)&&(mouseY<170)&&(mouseY>214)){ page = 6; } else if ((page == 7) || (page == 42)&&(mouseX>=209)&&(mouseX<=367)&&(mouseY<347)&&(mouseY>170)){//choose yellow page = 41; } else if ((page == 7) || (page == 41)&&(mouseX>=427)&&(mouseX<=534)&&(mouseY<=370)&&(mouseY>172)){//choose green page = 42; } else if (((page == 25) || (page == 44)&&(mouseX>=202)&&(mouseX<=366)&&(mouseY>=177)&&(mouseY<=348))){//choose red page = 43; } else if (((page == 25) || (page == 43)&&(mouseX>=397)&&(mouseX<=565)&&(mouseY>=177)&&(mouseY<=348))){ page = 44; } } void mousePressed(){ /*if ((page == 1)){ page = 2; } else*/ if ((page == 2)){ page = 3; } else if ((page == 3)){ page = 4; //} else if ((page == 4)&&(mouseX>430)&&(mouseX<550)&&(mouseY>86)&&(mouseY<326)){ //page = 5; } else if ((page == 39)){ page = 25; } else if ((page == 40)){ page = 5; } else if ((page == 5)/*&&(mouseX>379)&&(mouseX<451)&&(mouseY>146)&&(mouseY<239)*/){ //how come it wont let me click on the right item? //if i put that code in then the page doesn't let me click... //is there any way to make it so that when it hovers over the right item it automatically moves to next page? page = 6; } else if ((page == 6)){ page = 7; } else if ((page == 41)&&(mouseX>230)&&(mouseX<340)&&(mouseY>176)&&(mouseY<343)){ page = 8; } else if ((page == 42)&&(mouseX>433)&&(mouseX<531)&&(mouseY>171)&&(mouseY<368)){ page = 18; } else if ((page == 8)&&(mouseX>153)&&(mouseX<382)&&(mouseY>323)&&(mouseY<344)){ page = 10; } else if ((page == 8)&&(mouseX>153)&&(mouseX<382)&&(mouseY>350)&&(mouseY<371)){ page = 9; } else if ((page == 9)){ page = 1; } else if ((page == 10)){ page = 11; } else if ((page == 18)){ page = 19; } else if ((page == 19)&&(mouseX>142)&&(mouseX<171)&&(mouseY>155)&&(mouseY<184)){ page = 20; } else if ((page == 20)){ page = 21; } else if ((page == 21)){ page = 22; } else if ((page == 22)){ page = 23; } else if ((page == 25)&&(mouseX>211)&&(mouseX<361)&&(mouseY>194)&&(mouseY>186)&&(mouseY<337)){ page = 26; } else if((page == 26)){ page = 27; } else if((page == 27)){ page = 28; } else if ((page == 25)&&(mouseX>399)&&(mouseX<559)&&(mouseY>185)&&(mouseY<346)){ page = 33; } else if ((page == 33)){ page = 34; } else if ((page == 34)){ //INTERACTIVE DDR-ISH SLIDE. WTF DO I DO?!?!! page = 35; } else if ((page == 38)){ page = 28; } else if ((page == 29)){ page = 30; } else if ((page == 30)){ page = 31; } else if ((page == 32)){ page = 1; } else if ((page == 17)){ page = 1; } else if ((page == 13)){ page = 11; } else if ((page == 12)){ page = 14; }else if ((page == 14)){ page=15; } else if ((page == 15)){ page = 16; } else if ((page == 43)){ page = 26; } else if ((page == 44)){ page = 33; } }