int page = 1;
PImage plants;
PImage snail;
PImage lizard;
PImage plantfood;
PImage bugfood;
PImage flowerfood;
PImage jungle;
PImage turtle;
PImage fish;
PImage jellyfish;
PImage frog;
PImage shesnail;
PFont font;
PImage river;
PImage water;
void setup() {
size(600, 400);
background(175,206, 110);
plants = loadImage ("plants.png");
snail = loadImage ("snail.png");
lizard = loadImage ("lizard.png");
plantfood = loadImage ("plantfood.png");
bugfood = loadImage ("bugfood.png");
flowerfood = loadImage ("flowerfood.png");
jungle = loadImage ("jungle.png");
turtle = loadImage ("turtle.png");
fish = loadImage("fish.png");
jellyfish = loadImage("jellyfish.png");
frog = loadImage("frog.png");
shesnail = loadImage("shesnail.png");
font = loadFont("font.vlw");
river = loadImage ("river.png");
water = loadImage("water.png");
}
void draw() {
if (page == 1) {
background(plants);
image(snail, 400, 200);
String welcome = ("Welcome to Snail Search! Your mission is to travel through the wilderness, make the right choices, and find your mate. Good Luck!");
textFont(font);
stroke(255);
fill(255);
textAlign(CENTER);
textSize(24);
text(welcome, 50,250,500, 100);
String left = ("LEFT");
String right = ("RIGHT");
rect(60, 348, 75, 25);
rect(460, 348, 75, 25);
fill(0);
text(left, 100, 370);
text(right, 500, 370);
String directions = ("Click to Choose");
fill(255);
textSize(16);
text(directions, 300, 370);
}
else if (page == 2) {
background(166,201,99);
image(plantfood, 100, 50, 100, 100);
image(bugfood, 250, 50, 100, 100);
image(flowerfood, 400, 50, 100, 100);
image(lizard, 30, 150, 300, 200);
String a = ("Oh no! This lizard looks hungry. Feed him something quickly so he'll leave you alone!");
textSize(24);
text(a, 350, 200, 150, 150);
String directions = ("Click to Choose");
textSize(16);
text(directions, 420, 370);
}
else if (page == 3) {
background(166,201,99);
image(jungle, 0,0,450,400);
textSize(24);
String c = ("The lizard was very happy with that meal so he showed you a short cut through the jungle!");
text(c, 485, 70, 80, 350);
fill(0);
stroke(0);
rect(450, 350, 150, 50);
String directions = ("Click Here to Continue");
fill(255);
textSize(16);
text(directions, 485, 355, 80, 50);
}
else if (page == 4) {
background(166,201,99);
image(plantfood, 100, 50, 100, 100);
image(bugfood, 250, 50, 100, 100);
image(flowerfood, 400, 50, 100, 100);
String b = ("Oh no! The lizard didn't want that food. Try again!");
textSize(24);
text(b, 300,250);
}
else if (page == 5) {
background(166,201,99);
image(river,0,0);
image(turtle, 350, 70, 150, 90);
image(jellyfish, 500, 100, 80, 250);
image(fish, 280, 170, 200, 90);
String d = ("You've come to a very rough river. Which animal would you like to have help you across the river?");
fill(58, 129, 214);
textSize(24);
text(d, 200, 285, 350, 100);
String directions = ("Click to Choose");
textSize(16);
text(directions, 375, 385);
}
else if (page == 6) {
background(175, 206, 110);
String e = ("Good choice! You made it across safely! And HOORAY! the perfect girl was there waiting for you!");
textSize(24);
fill(255);
text(e, 140, 120, 350, 300);
fill(0);
stroke(0);
rect(202, 336, 188, 54);
String directions = ("Click Here to Continue");
fill(255);
textSize(16);
text(directions, 300, 370);
}
else if (page == 7) {
image(water, 0,0, 600, 400);
image(frog, 100, 150, 200, 200);
String f = ("Oh no! The jellyfish stung you and you fell into the river! A frog offers you a ride to the other side...");
textSize(24);
fill(0);
text(f, 140, 100, 350, 300);
String g = ("Accept?");
String h = ("Decline?");
fill(255);
rect(60, 348, 95, 25);
rect(460, 348, 95, 25);
fill(0);
text(g, 107, 370);
text(h, 507, 370);
}
else if (page == 8) {
background(166,201,99);
fill(255);
stroke(255);
rect(433, 173, 52, 28);
String i = ("Oh no! The fish ate you! If you want to try again, just click here to continue.");
String j = ("GAME OVER!");
textSize(36);
fill(139, 8, 8);
text(j, 315, 100);
textSize(24);
fill(0);
text(i, 160, 150, 300, 400);
}
else if (page ==9) {
background(plants);
image(snail, 400, 200);
image(shesnail, 200, 200);
String k = ("Congratulations! You've found your mate! Isn't she beautiful? You live happily ever after together...");
fill(255);
textSize(24);
text(k, 50,50,500, 100);
stroke(0);
fill(0);
rect(150, 350, 100, 75);
String l = ("Click Here to Play Again!");
textSize(16);
fill(255);
text(l, 155, 355, 90, 70);
}
else if (page == 10) {
background(166,201,99);
fill(255);
stroke(255);
rect(243, 232, 52, 28);
String i = ("Oh no! The currents were too strong and you didn't quite make it! If you want to try again, just click here to continue.");
String j = ("GAME OVER!");
textSize(36);
fill(139, 8, 8);
text(j, 315, 100);
textSize(24);
fill(0);
text(i, 160, 150, 300, 400);
}
}
void mousePressed() {
if ((page == 2) && (mouseX > 100) && (mouseX < 200) && (mouseY > 50) && (mouseY < 150)) {
page = 4;
}
else if ((page == 2) && (mouseX > 250) && (mouseX < 350) && (mouseY > 50) && (mouseY < 150)) {
page = 3;
}
else if((page == 2) && (mouseX>400) && (mouseX<500) && (mouseY>50) && (mouseY<150)) {
page = 4;
}
else if ((page == 4) && (mouseX > 100) && (mouseX < 200) && (mouseY > 50) && (mouseY < 150)) {
page = 4;
}
else if ((page == 4) && (mouseX > 250) && (mouseX < 350) && (mouseY > 50) && (mouseY < 150)) {
page = 3;
}
else if((page == 4) && (mouseX>400) && (mouseX<500) && (mouseY>50) && (mouseY<150)) {
page = 4;
}
else if((page == 1) && (mouseX>60) && (mouseX < 135) && (mouseY > 348) && (mouseY< 373)) {
page = 5;
}
else if ((page ==1) && (mouseX >460) && (mouseX < 535) && (mouseY > 348) && (mouseY < 373)) {
page = 2;
}
else if ((page == 5) && (mouseX > 367) && (mouseX < 500) && (mouseY >75) && (mouseY<155)) {
page =6;
}
else if ((page == 5) && (mouseX>512) && (mouseX<583) && (mouseY > 122) && (mouseY <319)) {
page = 7;
}
else if ((page == 5) && (mouseX>282) && (mouseX< 481) && (mouseY > 186) && (mouseY < 260)) {
page = 8;
}
else if((page == 7) && (mouseX>60) && (mouseX < 135) && (mouseY > 348) && (mouseY< 373)) {
page = 9;
}
else if ((page ==7) && (mouseX >460) && (mouseX < 535) && (mouseY > 348) && (mouseY < 373)) {
page = 10;
}
else if ((page == 3) && (mouseX > 450) && (mouseX < 600) && (mouseY > 350) && (mouseY <400)) {
page = 9;
}
else if ((page == 6) && (mouseX < 390) && (mouseX > 202) && (mouseY < 390) && (mouseY > 336)) {
page = 9;
}
else if ((page == 8) && (mouseX < 491) && (mouseX > 437) && (mouseY > 177) && (mouseY < 206)) {
page = 1;
}
else if ((page == 9) && (mouseX > 150) && (mouseX < 250) && (mouseY >350) && (mouseY < 400)) {
page = 1;
}
else if ((page == 10) && (mouseX > 245) && (mouseX < 298) && (mouseY > 236) && (mouseY < 262)) {
page = 1;
}
}
Jessica - Project 1
on Monday, Oct 27, 2008 – 9:39 pm
One Comment
This is such a fun program! I won on the first try…. what is this class?