Cindy - Project 1

By Cindy Chi

I tried to make my program smaller in size so it would load but unfortunately I had no luck! It only went down about 0.1MBs. So here is a place where you can download the .jar file and play it on your own. =)

CLICK HERE TO DOWNLOAD DOUGLAS!

*************************************************************************

/* CINDY CHI OCTOBER 27, 2008 DESMA 28: INTERACTIVITY PROJECT 1 ----------------------------DOUGLAS------------------------------- "Live and learn. At any rate, you live." -Douglas Adams Douglas is a program that takes the user through a game of life and the habits that you have as a baby affect who you are as an adult. A successful life is defined by a well taken care baby that evolves into the appropriate form according to how the baby was rasied. Actions all come with risks and benefits. Some risks may lead to death and other risks affect evolutional progress. The choice to take risks, however, may lead to great benefits. **Sidenote: The bubbles are supposed to be a visual representation of the baby's statistics. The better health you are in, the more bubbles it will have. The bubbles are grouped into color groups cooresponding to the colors in your stastics! NOTE: THIS IS A DIFFERENT SHORTENED VERSION OF WHAT I HAD BEFORE. MY GOAL WAS TO MAKE A GAME IN WHICH THE EVOLVED FORM COULD PRODUCE OFFSPRING. YOUR HABITS AS A BABY AS WELL AS THE CHOICES YOU MAKE AS AN EVOLVED FORM WERE TO AFFECT WHETHER YOU COULD SUCCESSFULLY MATE. This game still needs to be tweaked for difficulty level. It may be a little too easy/hard to evolve but IT IS possible. Sorry for all the println()s... I used them to check stuff throughout the process of programming and kept them in incase I wanted to add more stuff later. POSSIBLE ENDINGS: -Poisoned to death (by juice or by magic) -Exhausted to death (lack of rest) -Starved to death (lack of sustenance) -Made it to evolution but chose wrong form (SO CLOSE!) -Made it to evolution and chose right form (WIN!) EVOLUTIONARY FORM CHARACTERS: -Swimmer is playful and so it needs to have tokens from when it was a baby. -Flyer is a vegetarian so it needs to have eaten some veggies as a baby. -Crawler is a carnivoure so it needs to have eaten some meat as a baby. */ int page = 0; int tries = 0; //keeps track of number of tries int poison_chance = int(random(0, 100)); //Goal & tokens int evolution = 0; int tokens = 0; //Statistics PFont stat_num; int bathroom = 10; int hygiene = 10; int rest = 10; int sustenance = 10; //Page 22: Treasure hunt boolean hole1 = false; boolean hole2 = false; boolean hole3 = false; boolean hole4 = false; boolean hole5 = false; boolean hole6 = false; boolean hole7 = false; boolean hole8 = false; boolean hole9 = false; boolean hole10 = false; boolean hole11 = false; boolean hole12 = false; float chest_appear = floor(random(1, 12.99)); //random # to set where chest is hidden boolean chest_hole1 = false; boolean chest_hole2 = false; boolean chest_hole3 = false; boolean chest_hole4 = false; boolean chest_hole5 = false; boolean chest_hole6 = false; boolean chest_hole7 = false; boolean chest_hole8 = false; boolean chest_hole9 = false; boolean chest_hole10 = false; boolean chest_hole11 = false; boolean chest_hole12 = false; //Page 222: Scrambler PFont answer; PFont question; String unscrambled = ""; //user input String scrambled = ""; //scrambled word int pick_word = floor(random(1, 8.9)); //Page 2222: Hidden Gift int pick_creature = floor(random(1, 3.9)); boolean creature1 = false; boolean creature2 = false; boolean creature3 = false; //Page 33: Toilet int start_time; int toilet_time = 0; //the time that is displayed //Page 333: Shower float shower_y = 0.0; //starting y position of circles //Page 4: Bedroom int bg_opacity = 0; //so image fades in and out //Page 55: Drink int drink_y = 342; boolean set_drink = false; boolean juice = false; //Page 555: Eat int veggies_count = 0; //used for evolving int meat_count = 0; //Pages 5551, 5554, 5558: Eat veggies, meat, magic int bites = 0; ////////////////////DECLARE IMAGES //Deaths PImage starved; PImage poisoned; PImage exhausted; //Page 1000: Need More Tokens PImage more_tokens; //Page 0: Start PImage start; //Page 1: Statistics PImage stats; //Visual representation (bubbles) PImage evolution1; PImage evolution2; PImage evolution3; PImage evolution4; PImage evolution5; PImage evolution6; PImage evolution7; PImage evolution8; PImage evolution9; PImage evolution10; PImage bathroom1; PImage bathroom2; PImage bathroom3; PImage bathroom4; PImage bathroom5; PImage bathroom6; PImage bathroom7; PImage bathroom8; PImage bathroom9; PImage bathroom10; PImage hygiene1; PImage hygiene2; PImage hygiene3; PImage hygiene4; PImage hygiene5; PImage hygiene6; PImage hygiene7; PImage hygiene8; PImage hygiene9; PImage hygiene10; PImage rest1; PImage rest2; PImage rest3; PImage rest4; PImage rest5; PImage rest6; PImage rest7; PImage rest8; PImage rest9; PImage rest10; PImage sustenance1; PImage sustenance2; PImage sustenance3; PImage sustenance4; PImage sustenance5; PImage sustenance6; PImage sustenance7; PImage sustenance8; PImage sustenance9; PImage sustenance10; //Page 2: Toy bin PImage toybin; PImage lose; PImage win; //Treasure hunt PImage treasurehunt; PImage chest; PImage shovel; //Scrambler PImage scrambler; //Hidden Gift PImage hiddengift; PImage lose_gift; //Page 3: Bathroom PImage bath_room; PImage toilet; PImage shower; PImage shower_clean; //Page 4: Bedroom PImage bedroom; //Page 5: Kitchen PImage kitchen; //drink PImage drink; PImage drink_hitd; //text that displays to cue user to drink PImage need_bath; //warns user they need to use bathroom //eat PImage eat; PImage veggies1; PImage veggies2; PImage veggies3; PImage meat1; PImage meat2; PImage meat3; PImage magic1; PImage magic2; PImage magic3; PImage finished_food; //Page 6: Evolution PImage evolve; //EVOLUTION ENDINGS PImage success; PImage fail; void setup() { size(600, 400); smooth(); noStroke(); ////////////////////LOAD IMAGES //Page 1000: Need more Tokens more_tokens = loadImage("tokens.gif"); //Page 1001:Starved to death starved = loadImage("starved.gif"); //Page 1002: Poisoned poisoned = loadImage("piosoned.gif"); //Page 1003: Exhausted exhausted = loadImage("exhausted.gif"); //Page 0: Start start = loadImage("start.jpg"); //Page 1: Statistics stats = loadImage("home.jpg"); stat_num = loadFont("GrotesqueMTStd-14.vlw"); //Visual representation bubbles evolution1 = loadImage("bubble_ev1.png"); evolution2 = loadImage("bubble_ev2.png"); evolution3 = loadImage("bubble_ev3.png"); evolution4 = loadImage("bubble_ev4.png"); evolution5 = loadImage("bubble_ev5.png"); evolution6 = loadImage("bubble_ev6.png"); evolution7 = loadImage("bubble_ev7.png"); evolution8 = loadImage("bubble_ev8.png"); evolution9 = loadImage("bubble_ev9.png"); evolution10 = loadImage("bubble_ev10.png"); bathroom1 = loadImage("bubble_bath1.png"); bathroom2 = loadImage("bubble_bath2.png"); bathroom3 = loadImage("bubble_bath3.png"); bathroom4 = loadImage("bubble_bath4.png"); bathroom5 = loadImage("bubble_bath5.png"); bathroom6 = loadImage("bubble_bath6.png"); bathroom7 = loadImage("bubble_bath7.png"); bathroom8 = loadImage("bubble_bath8.png"); bathroom9 = loadImage("bubble_bath9.png"); bathroom10 = loadImage("bubble_bath10.png"); hygiene1 = loadImage("bubble_hyg1.png"); hygiene2 = loadImage("bubble_hyg2.png"); hygiene3 = loadImage("bubble_hyg3.png"); hygiene4 = loadImage("bubble_hyg4.png"); hygiene5 = loadImage("bubble_hyg5.png"); hygiene6 = loadImage("bubble_hyg6.png"); hygiene7 = loadImage("bubble_hyg7.png"); hygiene8 = loadImage("bubble_hyg8.png"); hygiene9 = loadImage("bubble_hyg9.png"); hygiene10 = loadImage("bubble_hyg10.png"); rest1 = loadImage("bubble_rest1.png"); rest2 = loadImage("bubble_rest2.png"); rest3 = loadImage("bubble_rest3.png"); rest4 = loadImage("bubble_rest4.png"); rest5 = loadImage("bubble_rest5.png"); rest6 = loadImage("bubble_rest6.png"); rest7 = loadImage("bubble_rest7.png"); rest8 = loadImage("bubble_rest8.png"); rest9 = loadImage("bubble_rest9.png"); rest10 = loadImage("bubble_rest10.png"); sustenance1 = loadImage("bubble_sus1.png"); sustenance2 = loadImage("bubble_sus2.png"); sustenance3 = loadImage("bubble_sus3.png"); sustenance4 = loadImage("bubble_sus4.png"); sustenance5 = loadImage("bubble_sus5.png"); sustenance6 = loadImage("bubble_sus6.png"); sustenance7 = loadImage("bubble_sus7.png"); sustenance8 = loadImage("bubble_sus8.png"); sustenance9 = loadImage("bubble_sus9.png"); sustenance10 = loadImage("bubble_sus10.png"); //Page 2: Toy Bin toybin = loadImage("toybin.jpg"); win = loadImage("toybin_win.gif"); lose = loadImage("toybin_lose.gif"); //Treast Hunt treasurehunt = loadImage("treasurehunt.gif"); shovel = loadImage("treasurehunt_shovel.png"); chest = loadImage("treasurehunt_chest.png"); //Scrambler scrambler = loadImage("scrambler.jpg"); question = loadFont("GrotesqueMTStd-72.vlw"); answer = loadFont("GrotesqueMTStd-48.vlw"); //Hidden Gift hiddengift = loadImage("hiddengift.jpg"); lose_gift = loadImage("toybin_hiddengift_lose.gif"); //Page 3: Bathroom bath_room = loadImage("bathroom.jpg"); toilet = loadImage("bathroom_toilet.jpg"); shower = loadImage("bathroom_shower.jpg"); shower_clean = loadImage("shower_clean.gif"); //Page 4: Bedroom bedroom = loadImage("bedroom.jpg"); //Page 5: Kitchen kitchen = loadImage("kitchen.jpg"); //drink drink = loadImage("kitchen_drink.jpg"); drink_hitd = loadImage("kitchen_drink_hitd.png"); need_bath = loadImage("kitchen_needbath.gif"); //eat eat = loadImage("kitchen_eat.jpg"); veggies1 = loadImage("kitchen_eat_veggies1.jpg"); veggies2 = loadImage("kitchen_eat_veggies2.jpg"); veggies3 = loadImage("kitchen_eat_veggies3.jpg"); meat1 = loadImage("kitchen_eat_meat1.jpg"); meat2 = loadImage("kitchen_eat_meat2.jpg"); meat3 = loadImage("kitchen_eat_meat3.jpg"); magic1 = loadImage("kitchen_eat_magic1.jpg"); magic2 = loadImage("kitchen_eat_magic2.jpg"); magic3 = loadImage("kitchen_eat_magic3.jpg"); finished_food = loadImage("kitchen_eat_finished.jpg"); //Page 6: Evolution evolve = loadImage("evolution.jpg"); //Evolution endings fail = loadImage("gamefail.gif"); success = loadImage("gamesuccess.gif"); } void draw() { //println("hidden gift " + pick_creature); //println(chest_appear); //println("page " + page); //println("poison chance num " + poison_chance); int current_milli = millis(); //current time needed for timers //println(current_milli + " and " + start_time); //Statistics Page if(page == 1) { image(stats, 0, 0); ////////////Numbers textFont(stat_num); //Evolution if(evolution > 20) { evolution = 20; } fill(230, 111, 74); text(evolution + "/20", 507, 61); //Tokens fill(155); text(tokens, 507, 78); //Bathroom if(bathroom > 20) { bathroom = 20; } if(bathroom < 0) { bathroom = 0; } fill(133, 170, 45); text(bathroom + "/20", 507, 122); //Hygiene if(hygiene > 10) { hygiene = 10; } if(hygiene < 0) { hygiene = 0; } fill(38, 124, 106); text(hygiene + "/10", 507, 139); //Rest if(rest > 20) { rest = 20; } fill(175, 119, 108); text(rest + "/20", 507, 156); //Sustenance if(sustenance > 30) { sustenance = 30; } fill(146, 33, 9); text(sustenance + "/30", 507, 173); ////////////Check Stats for possible death if(sustenance <= 0) //starved to death { page = 1001; } if(rest <= 0) //exhausted to death { page = 1003; } /////////////EVOLVING!!!! if(evolution >= 20) { page = 6; } ////////////Visual Representation //Evolution if(evolution <= 2) { image(evolution1, 0, 0); } else if(evolution <= 4) { image(evolution1, 0, 0); image(evolution2, 0, 0); } else if(evolution <= 6) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); } else if(evolution <= 8) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); } else if(evolution <= 10) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); image(evolution5, 0, 0); } else if(evolution <= 12) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); image(evolution5, 0, 0); image(evolution6, 0, 0); } else if(evolution <= 14) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); image(evolution5, 0, 0); image(evolution6, 0, 0); image(evolution7, 0, 0); } else if(evolution <= 16) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); image(evolution5, 0, 0); image(evolution6, 0, 0); image(evolution7, 0, 0); image(evolution8, 0, 0); } else if(evolution <= 18) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); image(evolution5, 0, 0); image(evolution6, 0, 0); image(evolution7, 0, 0); image(evolution8, 0, 0); image(evolution9, 0, 0); } else if(evolution <= 20) { image(evolution1, 0, 0); image(evolution2, 0, 0); image(evolution3, 0, 0); image(evolution4, 0, 0); image(evolution5, 0, 0); image(evolution6, 0, 0); image(evolution7, 0, 0); image(evolution8, 0, 0); image(evolution9, 0, 0); image(evolution10, 0, 0); } //Bathroom if(bathroom <= 2) { image(bathroom1, 0, 0); } else if(bathroom <= 4) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); } else if(bathroom <= 6) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); } else if(bathroom <= 8) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); } else if(bathroom <= 10) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); image(bathroom5, 0, 0); } else if(bathroom <= 12) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); image(bathroom5, 0, 0); image(bathroom6, 0, 0); } else if(bathroom <= 14) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); image(bathroom5, 0, 0); image(bathroom6, 0, 0); image(bathroom7, 0, 0); } else if(bathroom <= 16) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); image(bathroom5, 0, 0); image(bathroom6, 0, 0); image(bathroom7, 0, 0); image(bathroom8, 0, 0); } else if(bathroom <= 18) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); image(bathroom5, 0, 0); image(bathroom6, 0, 0); image(bathroom7, 0, 0); image(bathroom8, 0, 0); image(bathroom9, 0, 0); } else if(bathroom <= 20) { image(bathroom1, 0, 0); image(bathroom2, 0, 0); image(bathroom3, 0, 0); image(bathroom4, 0, 0); image(bathroom5, 0, 0); image(bathroom6, 0, 0); image(bathroom7, 0, 0); image(bathroom8, 0, 0); image(bathroom9, 0, 0); image(bathroom10, 0, 0); } //Hygiene if(hygiene <=1) { image(hygiene1, 0, 0); } else if(hygiene <=2) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); } else if(hygiene <=3) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); } else if(hygiene <=4) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); } else if(hygiene <=5) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); image(hygiene5, 0, 0); } else if(hygiene <=6) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); image(hygiene5, 0, 0); image(hygiene6, 0, 0); } else if(hygiene <=7) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); image(hygiene5, 0, 0); image(hygiene6, 0, 0); image(hygiene7, 0, 0); } else if(hygiene <=8) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); image(hygiene5, 0, 0); image(hygiene6, 0, 0); image(hygiene7, 0, 0); image(hygiene8, 0, 0); } else if(hygiene <=9) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); image(hygiene5, 0, 0); image(hygiene6, 0, 0); image(hygiene7, 0, 0); image(hygiene8, 0, 0); image(hygiene9, 0, 0); } else if(hygiene <=10) { image(hygiene1, 0, 0); image(hygiene2, 0, 0); image(hygiene3, 0, 0); image(hygiene4, 0, 0); image(hygiene5, 0, 0); image(hygiene6, 0, 0); image(hygiene7, 0, 0); image(hygiene8, 0, 0); image(hygiene9, 0, 0); image(hygiene10, 0, 0); } //Rest if (rest <= 2) { image(rest1, 0, 0); } else if(rest <= 4) { image(rest1, 0, 0); image(rest2, 0, 0); } else if(rest <= 6) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); } else if(rest <= 8) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); } else if(rest <= 10) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); image(rest5, 0, 0); } else if(rest <= 12) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); image(rest5, 0, 0); image(rest6, 0, 0); } else if(rest <= 14) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); image(rest5, 0, 0); image(rest6, 0, 0); image(rest7, 0, 0); } else if(rest <= 16) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); image(rest5, 0, 0); image(rest6, 0, 0); image(rest7, 0, 0); image(rest8, 0, 0); } else if(rest <= 18) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); image(rest5, 0, 0); image(rest6, 0, 0); image(rest7, 0, 0); image(rest8, 0, 0); image(rest9, 0, 0); } else if(rest <= 20) { image(rest1, 0, 0); image(rest2, 0, 0); image(rest3, 0, 0); image(rest4, 0, 0); image(rest5, 0, 0); image(rest6, 0, 0); image(rest7, 0, 0); image(rest8, 0, 0); image(rest9, 0, 0); image(rest10, 0, 0); } //Sustenance if(sustenance <= 3) { image(sustenance1, 0, 0); } else if(sustenance <= 6) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); } else if(sustenance <= 9) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); } else if(sustenance <= 12) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); } else if(sustenance <= 15) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); image(sustenance5, 0, 0); } else if(sustenance <= 18) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); image(sustenance5, 0, 0); image(sustenance6, 0, 0); } else if(sustenance <= 21) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); image(sustenance5, 0, 0); image(sustenance6, 0, 0); image(sustenance7, 0, 0); } else if(sustenance <= 24) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); image(sustenance5, 0, 0); image(sustenance6, 0, 0); image(sustenance7, 0, 0); image(sustenance8, 0, 0); } else if(sustenance <= 27) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); image(sustenance5, 0, 0); image(sustenance6, 0, 0); image(sustenance7, 0, 0); image(sustenance8, 0, 0); image(sustenance9, 0, 0); } else if(sustenance <= 30) { image(sustenance1, 0, 0); image(sustenance2, 0, 0); image(sustenance3, 0, 0); image(sustenance4, 0, 0); image(sustenance5, 0, 0); image(sustenance6, 0, 0); image(sustenance7, 0, 0); image(sustenance8, 0, 0); image(sustenance9, 0, 0); image(sustenance10, 0, 0); } } //TOY BIN else if(page == 2) { image(toybin, 0, 0); } //TOY BIN: TREASURE HUNT else if(page == 22) { image(treasurehunt, 0, 0); //if statements to set where treausure is if(chest_appear == 1) { chest_hole1 = true; } else if(chest_appear == 2) { chest_hole2 = true; } else if(chest_appear == 3) { chest_hole3 = true; } else if(chest_appear == 4) { chest_hole4 = true; } else if(chest_appear == 5) { chest_hole5 = true; } else if(chest_appear == 6) { chest_hole6 = true; } else if(chest_appear == 7) { chest_hole7 = true; } else if(chest_appear == 8) { chest_hole8 = true; } else if(chest_appear == 9) { chest_hole9 = true; } else if(chest_appear == 10) { chest_hole10 = true; } else if(chest_appear == 11) { chest_hole11 = true; } else if(chest_appear == 12) { chest_hole12 = true; } //if statements to reveal dug holes if(hole1 == true) { ellipse(75, 100, 110, 110); if(chest_hole1 == true) { image(chest, -20, 20); } } if(hole2 == true) { ellipse(75, 220, 110, 110); if(chest_hole2 == true) { image(chest, -20, 140); } } if(hole3 == true) { ellipse(75, 340, 110, 110); if(chest_hole3 == true) { image(chest, -20, 260); } } if(hole4 == true) { ellipse(225, 100, 110, 110); if(chest_hole4 == true) { image(chest, 130, 20); } } if(hole5 == true) { ellipse(225, 220, 110, 110); if(chest_hole5 == true) { image(chest, 130, 140); } } if(hole6 == true) { ellipse(225, 340, 110, 110); if(chest_hole6 == true) { image(chest, 130, 260); } } if(hole7 == true) { ellipse(375, 100, 110, 110); if(chest_hole7 == true) { image(chest, 280, 20); } } if(hole8 == true) { ellipse(375, 220, 110, 110); if(chest_hole8 == true) { image(chest, 280, 140); } } if(hole9 == true) { ellipse(375, 340, 110, 110); if(chest_hole9 == true) { image(chest, 280, 260); } } if(hole10 == true) { ellipse(525, 100, 110, 110); if(chest_hole10 == true) { image(chest, 430, 20); } } if(hole11 == true) { ellipse(525, 220, 110, 110); if(chest_hole11 == true) { image(chest, 430, 140); } } if(hole12 == true) { ellipse(525, 340, 110, 110); if(chest_hole12 == true) { image(chest, 430, 260); } } image(shovel, mouseX, mouseY - 150); //win if(tries <= 6) { if(hole1 == true && chest_hole1 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole2 == true && chest_hole2 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole3 == true && chest_hole3 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole4 == true && chest_hole4 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole5 == true && chest_hole5 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole6 == true && chest_hole6 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole7 == true && chest_hole7 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole8 == true && chest_hole8 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole9 == true && chest_hole9 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole10 == true && chest_hole10 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole11 == true && chest_hole11 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } if(hole12 == true && chest_hole12 == true) { evolution +=2; tokens++; rest--; sustenance--; hygiene--; bathroom--; page = 221; } } //lose else { rest--; sustenance--; hygiene--; bathroom--; page = 222222; } } //TOY BIN: TREASURE HUNT WIN PAGE else if(page == 221) { } //TOY BIN: SCRAMBLER else if(page == 222) { //println(pick_word); //Possible words if(pick_word == 1) { scrambled = "gegs"; } else if(pick_word == 2) { scrambled = "ttsoghuh"; } else if(pick_word == 3) { scrambled = "rcutlte"; } else if(pick_word == 4) { scrambled = "rcysru"; } else if(pick_word == 5) { scrambled = "ffhusle"; } else if(pick_word == 6) { scrambled = "xmied"; } else if(pick_word == 7) { scrambled = "bjluem"; } else if(pick_word == 8) { scrambled = "ahcos"; } image(scrambler, 0, 0); fill(201, 114, 139); textFont(question); text(scrambled, 225, 180); fill(175, 170, 63); textFont(answer); text(unscrambled, 225, 335); } //TOY BIN: HIDDEN GIFT else if(page == 2222) { //Sets where gift is hidden if(pick_creature == 1) { creature1 = true; //then it's hidden under this creature } if(pick_creature == 2) { creature2 = true; } if(pick_creature ==3) { creature3 = true; } image(hiddengift, 0, 0); } //TOY BIN: WIN PAGE else if(page == 22222) { image(win, 0, 0); } //TOY BIN: LOSE PAGE else if(page == 222222) { image(lose, 0, 0); } //TOY BIN: HIDDEN GIFT LOSE PAGE else if(page == 2222222) { image(lose_gift, 0, 0); } //PAGE 3: BATHROOM else if(page == 3) { image(bath_room, 0, 0); } //BATHROOM: TOILET else if(page == 33) { image(toilet, 0, 0); //Display time current_milli = millis(); textFont(question); fill(207, 0, 0); text(toilet_time, 121, 256); if(current_milli >= (start_time + 1000)) { toilet_time = 1; } if(current_milli >= (start_time + 2000)) { toilet_time = 2; } if(current_milli >= (start_time + 3000)) { toilet_time = 3; } if(current_milli >= (start_time + 4000)) { toilet_time = 4; } if(current_milli >= (start_time + 5000)) { toilet_time = 5; } } //BATHROOM: SHOWER else if(page == 333) { shower_y = 0; //resets shower circles image(shower, 0, 0); //Blue circles that continuously come down to "wash" grime away fill(0, 186, 255); if(key == CODED) { if(keyCode == DOWN) { page = 3331; } } } //BATHROOM: SHOWER - AFTER DOWN KEY HAS BEEN HIT else if(page == 3331) { if(key == CODED) { if(keyCode == DOWN) { ellipse(75, shower_y, 150, 150); ellipse(225, shower_y * .5, 150, 150); ellipse(375, shower_y * .8, 150, 150); ellipse(525, shower_y * 2, 150, 150); shower_y++; //println(shower_y); } } //When done showering if(shower_y > 800) { //Tally points hygiene += 5; sustenance--; page = 3332; } } //BATHROOM: SHOWER - CLEANER else if(page == 3332) { image(shower_clean, 0, 0); } //PAGE 4: BEDROOM else if(page == 4) { image(bedroom, 0, 0); if(current_milli >= (start_time + 100)) { bg_opacity = 0; } if(current_milli >= (start_time + 200)) { bg_opacity = 43; } if(current_milli >= (start_time + 300)) { bg_opacity = 86; } if(current_milli >= (start_time + 400)) { bg_opacity = 129; } if(current_milli >= (start_time + 500)) { bg_opacity = 172; } if(current_milli >= (start_time + 600)) { bg_opacity = 215; } if(current_milli >= (start_time + 700)) { bg_opacity = 220; } if(current_milli >= (start_time + 800)) { bg_opacity = 225; } if(current_milli >= (start_time + 900)) { bg_opacity = 172; } if(current_milli >= (start_time + 1000)) { bg_opacity = 129; } if(current_milli >= (start_time + 1100)) { bg_opacity = 86; } if(current_milli >= (start_time + 1200)) { bg_opacity = 43; } if(current_milli >= (start_time + 1300)) { bg_opacity = 0; } if(current_milli >= (start_time + 1400)) { //Tally Points rest +=5; hygiene -= 2; sustenance -= 3; bathroom -= 2; page = 1; } fill(0, 0, 0, bg_opacity); rect(0, 0, 600, 400); } //PAGE 5: KITCHEN else if(page == 5) { image(kitchen, 0, 0); } //KITCHEN: WARNING NEED TO USE BATHROOM else if(page == 51) { image(need_bath, 0, 0); } //KITCHEN: DRINK else if(page == 55) { image(drink, 0, 0); } //KITCHEN: DRINK--FILL UP else if(page == 551) { if(mousePressed == true) { if(mouseX > 110 && mouseX < 385 && mouseY > 110 && mouseY < 342) { if(drink_y > 150) { rect(226, drink_y, 158, 4); drink_y--; } else { image(drink_hitd, 0, 0); } } } if(keyPressed == true && (key == 'd' || key == 'D')) { //Tally up points if(juice == true) { if(poison_chance < 10) { page = 1002; } else { sustenance += 3; rest++; evolution++; bathroom -= 3; page = 1; } } else //for water { sustenance += 2; bathroom -= 3; page = 1; } } } //KITCHEN: EAT else if(page == 555) { image(eat, 0, 0); } //KITCHEN: EAT - VEGGIES else if(page == 5551) { veggies_count++; image(veggies1, 0, 0); //Click & eat if(bites == 1) { image(veggies2, 0, 0); } else if(bites == 2) { image(veggies3, 0, 0); } else if(bites == 3) { image(finished_food, 0, 0); } else if(bites == 4) { //Tally points evolution++; sustenance += 4; bathroom -= 4; rest--; page = 1; } } //KITCHEN: EAT - MEAT else if(page == 5554) { meat_count++; image(meat1, 0, 0); //Click & eat if(bites == 1) { image(meat2, 0, 0); } else if(bites == 2) { image(meat3, 0, 0); } else if(bites == 3) { image(finished_food, 0, 0); } else if(bites == 4) { //Tally points evolution++; sustenance += 8; bathroom -= 5; rest -= 2; hygiene--; page = 1; } } //KITCHEN: EAT - MAGIC else if(page == 5558) { image(magic1, 0, 0); //Click & eat if(bites == 1) { image(magic2, 0, 0); } else if(bites == 2) { image(magic3, 0, 0); } else if(bites == 3) { if(poison_chance == 50) { page = 1002; } else { image(finished_food, 0, 0); } } else if(bites == 4) { //Tally points sustenance += 10; evolution += 3; bathroom -= 7; rest -= 5; hygiene -= 5; page = 1; } } //PAGE 6: EVOLUTION else if(page == 6) { image(evolve, 0, 0); } //PAGE 1000: NEED MORE TOKENS else if(page == 1000) { image(more_tokens, 0, 0); } //PAGE 1001: STARVATION else if(page == 1001) { image(starved, 0, 0); } //PAGE 1002: POISONED else if(page == 1002) { image(poisoned, 0, 0); } //PAGE 1003: EXHAUSTED else if(page == 1003) { image(exhausted, 0, 0); } //PAGE 1004: GAME SUCCESS!! else if(page == 1004) { image(success, 0, 0); } //PAGE 1005: GAME FAIL!! else if(page == 1005) { image(fail, 0, 0); } //PAGE 0: START PAGE else { image(start, 0, 0); } } void mousePressed() { //println("mouseX" + mouseX); //println("mouseY" + mouseY); if(page == 0) { if(mouseX > 503 && mouseX < 600 && mouseY > 367 && mouseY < 400) { page = 1; } } if(page == 1) { if(mouseX > 400 && mouseX < 600 && mouseY > 244 && mouseY < 280) { page = 2; } else if(mouseX > 400 && mouseX < 600 && mouseY > 280 && mouseY < 309) { page = 3; } else if(mouseX > 400 && mouseX < 600 && mouseY > 309 && mouseY < 338) { start_time = millis(); //for timer page = 4; } else if(mouseX > 400 && mouseX < 600 && mouseY > 338 && mouseY < 367) { page = 5; } } //Toy Bin else if(page == 2) { if(mouseX > 0 && mouseX < 206 && mouseY > 99 && mouseY < 346) { chest_appear = floor(random(1, 12.99)); //resets chest placement before entering game tries = 0; //resets tries page = 22; //treasure hunt //reset holes dug hole1 = false; hole2 = false; hole3 = false; hole4 = false; hole5 = false; hole6 = false; hole7 = false; hole8 = false; hole9 = false; hole10 = false; hole11 = false; hole12 = false; //reset chest_hole chest_hole1 = false; chest_hole2 = false; chest_hole3 = false; chest_hole4 = false; chest_hole5 = false; chest_hole6 = false; chest_hole7 = false; chest_hole8 = false; chest_hole9 = false; chest_hole10 = false; chest_hole11 = false; chest_hole12 = false; } else if(mouseX > 206 && mouseX < 393 && mouseY > 99 && mouseY < 346) { pick_word = floor(random(1, 8.9)); //resets word before entering game unscrambled = ""; //resets blank answer space page = 222; //scrambler } else if(mouseX > 393 && mouseX < 600 && mouseY > 99 && mouseY < 346) { pick_creature = floor(random(1, 3.9)); //resets where the gift is before entering game //Resetting where gift is hidden back to false creature1 = false; creature2 = false; creature3 = false; page = 2222; //hidden gift } } //Win and Lose pages - & Need more Tokens - & Clean - & Need_bath else if(page == 22222 || page == 222222 || page == 2222222 || page == 1000 || page == 3332 || page == 51) { page = 1; } //Treasure hunt else if(page == 22) { // println("chesthole1 " + chest_hole1); // println("chesthole2 " + chest_hole2); // println("chesthole3 " + chest_hole3); // println("chesthole4 " + chest_hole4); // println("chesthole5 " + chest_hole5); // println("chesthole6 " + chest_hole6); // println("chesthole7 " + chest_hole7); // println("chesthole8 " + chest_hole8); // println("chesthole9 " + chest_hole9); // println("chesthole10 " + chest_hole10); // println("chesthole11 " + chest_hole11); // println("chestappear" + chest_appear); fill(57, 42, 4); if(mouseX > 0 && mouseX < 150 && mouseY > 40 && mouseY < 160) { hole1 = true; tries++; } if(mouseX > 0 && mouseX < 150 && mouseY > 160 && mouseY < 280) { hole2 = true; tries++; } if(mouseX > 0 && mouseX < 150 && mouseY > 280 && mouseY < 400) { hole3 = true; tries++; } if(mouseX > 150 && mouseX < 300 && mouseY > 40 && mouseY < 160) { hole4 = true; tries++; } if(mouseX > 150 && mouseX < 300 && mouseY > 160 && mouseY < 280) { hole5 = true; tries++; } if(mouseX > 150 && mouseX < 300 && mouseY > 280 && mouseY < 400) { hole6 = true; tries++; } if(mouseX > 300 && mouseX < 450 && mouseY > 40 && mouseY < 160) { hole7 = true; tries++; } if(mouseX > 300 && mouseX < 450 && mouseY > 160 && mouseY < 280) { hole8 = true; tries++; } if(mouseX > 300 && mouseX < 450 && mouseY > 280 && mouseY < 400) { hole9 = true; tries++; } if(mouseX > 450 && mouseX < 600 && mouseY > 40 && mouseY < 160) { hole10 = true; tries++; } if(mouseX > 450 && mouseX < 600 && mouseY > 160 && mouseY < 280) { hole11 = true; tries++; } if(mouseX > 450 && mouseX < 600 && mouseY > 280 && mouseY < 400) { hole12 = true; tries++; } } //Treasure Hunt Win Page else if(page == 221) { page = 22222; //win page } //Hidden Gift else if(page == 2222) { if(mouseX > 0 && mouseX < 205 && mouseY > 95 && mouseY < 352) { if(creature1 == true) { //Point tally evolution += 4; tokens +=2; rest--; sustenance--; hygiene--; bathroom--; page = 22222; } else { //Point tally evolution--; rest--; sustenance--; hygiene--; bathroom--; page = 2222222; } } if(mouseX > 205 && mouseX < 398 && mouseY > 95 && mouseY < 352) { if(creature2 == true) { //Point tally evolution += 4; tokens +=2; rest--; sustenance--; hygiene--; bathroom--; page = 22222; } else { //Point tally evolution--; rest--; sustenance--; hygiene--; bathroom--; page = 2222222; } } if(mouseX > 398 && mouseX < 600 && mouseY > 95 && mouseY < 352) { if(creature3 == true) { //Point tally evolution += 4; tokens +=2; rest--; sustenance--; hygiene--; bathroom--; page = 22222; } else { //Point tally evolution--; rest--; sustenance--; hygiene--; bathroom--; page = 2222222; } } } //Page 3: Bathroom else if(page == 3) { if(tokens > 0) { if(mouseX > 0 && mouseX < 281 && mouseY > 159 && mouseY < 341)//shower { tokens--; page = 333; } else if(mouseX > 281 && mouseX < 600 && mouseY > 159 && mouseY < 341) //toilet { tokens--; page = 33; toilet_time = 0; start_time = millis(); } } else { page = 1000; } } //Page 33: Toilet else if(page == 33) { if(toilet_time == 5) { if(mouseX > 309 && mouseX < 549 && mouseY > 179 && mouseY < 549) { bathroom += 10; sustenance -= 2; page = 1; } } } //Page 5: Bedroom else if(page == 4) { //start_time = millis(); } //Page 5: Kitchen else if(page == 5) { poison_chance = int(random(0, 100)); //resetting chance of being poisoned if(bathroom <= 0 || hygiene <= 0) { page = 51; //warning can't eat } else if(mouseX > 0 && mouseX < 300) //drink { juice = false; //resetting juice set_drink = false; //resetting drink page = 55; } else //eat { bites = 0; //resetting number of bites taken page = 555; } } //KITCHEN: DRINK else if(page == 55) { drink_y = 342; //reset starting point for fillup //Setting what kind of drink if(mouseX > 35 && mouseX < 160) { if(mouseY > 142 && mouseY < 184) { fill(255, 0, 174); //sets juice color set_drink = true; juice = true; } if(mouseY > 206 && mouseY < 248) { fill(255); //sets water color set_drink = true; } } //Filling up cup if(set_drink == true) //only after drink has been chosen { if(mouseX > 110 && mouseX < 385 && mouseY > 110 && mouseY < 342) { page = 551; } } } //KITCHEN: EAT else if(page == 555) { if(mouseY > 61 && mouseY < 208) { if(mouseX > 0 && mouseX < 182) { page = 5551; //veggies } else if(mouseX > 182 && mouseX < 400) { page = 5554; //meat } else if(mouseX > 400 && mouseX < 600) { if(tokens >= 2) { tokens -= 2; page = 5558; //magic } else { page = 1000; //need more tokens! } } } } //Keeps track of bites else if(page == 5551 || page == 5554 || page == 5558) { bites++; } //PAGE 6: EVOLUTION else if(page == 6) { //Swimmer: needs a lot of play as baby if(mouseX > 0 && mouseX < 285 && mouseY > 0 && mouseY < 257) { if(tokens >= 2) { page = 1004; } else { page = 1005; } } //Crawler: needs to eat a lot of meat as a baby if(mouseX > 285 && mouseX < 600 && mouseY > 0 && mouseY < 257) { if(meat_count >= 3) { page = 1004; } else { page = 1005; } } //Flyer: needs to eat a lot of veggies if(mouseX > 142 && mouseX < 475 && mouseY > 257 && mouseY < 400) { if(veggies_count >= 3) { page = 1004; } else { page = 1005; } } } } //FOR USER INPUT IN SCRAMBLER GAME void keyPressed() { if((key == ENTER) || (key == RETURN)) { unscrambled = unscrambled.toLowerCase(); if(scrambled.equals("gegs")) { if(unscrambled.equals("eggs")) { page = 22222; //win page //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //lose page //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("ttsoghuh")) { if(unscrambled.equals("thoughts")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("rcutlte")) { if(unscrambled.equals("clutter")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("rcysru")) { if(unscrambled.equals("scurry")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("ffhusle")) { if(unscrambled.equals("shuffle")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("xmied")) { if(unscrambled.equals("mixed")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("bjluem")) { if(unscrambled.equals("jumble")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } if(scrambled.equals("ahcos")) { if(unscrambled.equals("chaos")) { page = 22222; //Point tally evolution += 2; tokens++; rest--; sustenance--; hygiene--; bathroom--; } else { page = 222222; //Point tally rest--; sustenance--; hygiene--; bathroom--; } } } else if(key == BACKSPACE) { if(unscrambled.length() > 0) { unscrambled = unscrambled.substring(0, unscrambled.length() - 1); } } else if(textWidth(unscrambled + key) < width) { unscrambled = unscrambled + key; } }

One Comment

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

    I think this should display through the Web. It’s not that large. Let’s look at it on Wednesday.

Post a Comment

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

*
*