//The Organ Trail
//Project 1: Interactive Game
// *If things aren't loading properly, try refreshing.
int page = 0;
int s = 150;
PImage brain;
PImage cross;
PImage dinosaur;
PImage fakebeard;
PImage gums;
PImage heart;
PImage largeintestine;
PImage leaves;
PImage liver;
PImage lung;
PImage pupil;
PImage seastar;
PImage spine;
PImage friedegg;
PImage field;
PImage spineA;
PImage spineA2;
PImage spineB;
PImage spineB2;
PImage spineC;
PImage spineC2;
PImage spineD;
PImage spineD2;
PImage brain2;
PImage gums2;
PImage heart2;
PImage largeintestine2;
PImage liver2;
PImage pupil2;
PImage congrats;
PImage start;
PFont bigger;
PFont big;
PFont font;
PFont small;
PFont smaller;
String letters = "";
String s_pupil = "";
String s_gums = "";
String s_largeintestine = "";
String s_overworkedliver = "";
ImageButtons seastar_button;
ImageButtons dinosaur_button;
ImageButtons friedegg_button;
ImageButtons fakebeard_button;
ImageButtons lung_button;
ImageButtons spineA_button;
ImageButtons spineB_button;
ImageButtons spineC_button;
ImageButtons spineD_button;
boolean pSeastar = false;
boolean pDinosaur = false;
boolean pFriedegg = false;
boolean pFakebeard = false;
//page 4
boolean over = false;
boolean moveA = false;
boolean moveB = false;
boolean moveC = false;
boolean moveD = false;
void setup() {
size(600, 400);
smooth();
smaller = loadFont("DIN-Regular-14.vlw");
small = loadFont("DIN-Regular-20.vlw");
font = loadFont("DIN-Bold-20.vlw");
big = loadFont("DIN-Bold-30.vlw");
bigger = loadFont("DIN-Bold-48.vlw");
textFont(small);
fill(0);
textAlign(CENTER);
dinosaur = loadImage("dinosaur.png");
seastar = loadImage("seastar.png");
friedegg = loadImage("friedegg.png");
fakebeard = loadImage("fakebeard.png");
field = loadImage("field.png");
////buttons
PImage b = loadImage("seastar2.png");
PImage r = loadImage("seastar.png");
PImage d = loadImage("seastar.png");
int x = 0;
int y = 0;
int w = b.width;
int h = b.height;
seastar_button = new ImageButtons(40, 240, w, h, b, r, d);
b = loadImage("dinosaur2.png");
r = loadImage("dinosaur.png");
d = loadImage("dinosaur.png");
w = b.width;
h = b.height;
dinosaur_button = new ImageButtons(180, 170, w, h, b, r, d);
b = loadImage("friedegg2.png");
r = loadImage("friedegg.png");
d = loadImage("friedegg.png");
w = b.width;
h = b.height;
friedegg_button = new ImageButtons(300, 255, w, h, b, r, d);
b = loadImage("fakebeard2.png");
r = loadImage("fakebeard.png");
d = loadImage("fakebeard.png");
w = b.width;
h = b.height;
fakebeard_button = new ImageButtons(430, 245, w, h, b, r, d);
b = loadImage("lung2.png");
r = loadImage("lung.png");
d = loadImage("lung.png");
w = b.width;
h = b.height;
lung_button = new ImageButtons(519, 225, w, h, b, r, d);
/////page 4
spineA= loadImage("spineA.png");
spineB = loadImage("spineB.png");
spineC = loadImage("spineC.png");
spineD = loadImage("spineD.png");
spineA2= loadImage("spineA2.png");
spineB2 = loadImage("spineB2.png");
spineC2 = loadImage("spineC2.png");
spineD2 = loadImage("spineD2.png");
b = loadImage("spineA2.png");
r = loadImage("spineA.png");
d = loadImage("spineA.png");
w = b.width;
h = b.height;
spineA_button = new ImageButtons(143, 297, w, h, b, r, d);
b = loadImage("spineB2.png");
r = loadImage("spineB.png");
d = loadImage("spineB.png");
w = b.width;
h = b.height;
spineB_button = new ImageButtons(320, 254, w, h, b, r, d);
b = loadImage("spineC2.png");
r = loadImage("spineC.png");
d = loadImage("spineC.png");
w = b.width;
h = b.height;
spineC_button = new ImageButtons(200, 205, w, h, b, r, d);
b = loadImage("spineD2.png");
r = loadImage("spineD.png");
d = loadImage("spineD.png");
w = b.width;
h = b.height;
spineD_button = new ImageButtons(140, 150, w, h, b, r, d);
///page 6
pupil = loadImage("pupil.png");
gums = loadImage("gums.png");
heart = loadImage("heart.png");
largeintestine = loadImage("largeintestine.png");
brain = loadImage("brain.png");
liver = loadImage("liver.png");
pupil2 = loadImage("pupil2.png");
gums2 = loadImage("gums2.png");
heart2 = loadImage("heart2.png");
largeintestine2 = loadImage("largeintestine2.png");
brain2 = loadImage("brain2.png");
liver2 = loadImage("liver2.png");
leaves = loadImage("leaves.png");
congrats = loadImage("congrats.png");
start = loadImage("start.png");
}
void draw() {
background (175, 223, 229);
///cursor
if (pSeastar == true) {
if (page != 3) {
image(seastar, mouseX-25, mouseY-25, 50, 50);
}
}
if (pDinosaur == true) {
if (page != 3) {
image(dinosaur, mouseX-15, mouseY-36, 30, 72);
}
}
if (pFriedegg == true) {
if (page != 3) {
image(friedegg, mouseX-25, mouseY-25, 50, 50);
}
}
if (pFakebeard == true) {
if (page != 3) {
image(fakebeard, mouseX-30, mouseY-2, 60, 40);
}
}
///////////////////111111111 WELCOME////////////////////////
if (page == 1) {
/////text centering stuff
int g = 80;
int h = 40;
int j = 60;
int k = 0;
textFont(big);
text("welcome to the ORGAN TRAIL!", g, 60, width-2*g, 300);
textFont(small);
text("you've arrived here because you've lost all your organs and must embark on this mission to reclaim them.", 40, 100, 520, 300);
text("if you're up to the challenge,", h, 250, width-2*h, 180);
text("type in your name and then press enter", j, 275, width- 2*j, 200);
fill(198, 45, 55);
text(letters, 300, 320);
fill(0);
line(200, 325, 400, 325);
}
//////////////////22222222 CUSTOMIZE //////////////////////////
else if (page == 2) {
// text
int g = 80;
int h = 100;
int j = 375;
int k = 65;
textFont(font);
text("great, "+ letters + "! start by choosing the shape that most accurately reflects you as a creature", g, 60, width-2*g, 300);
textFont(small);
text("by clicking on it with your cursor:", h, 108, width - 2*h, 150);
textFont(smaller);
text("sea star", k+ 32, j);
text("dinosaur", k+ 155, j);
text("fried egg", k+ 285, j);
text("fake beard", k+ 435, j);
//clear cursors
pSeastar = false;
pDinosaur = false;
pFriedegg = false;
pFakebeard = false;
//Displaying buttons
seastar_button.update();
seastar_button.display();
dinosaur_button.update();
dinosaur_button.display();
friedegg_button.update();
friedegg_button.display();
fakebeard_button.update();
fakebeard_button.display();
cursor(HAND);
//If button is pressed
if (seastar_button.pressed == true) {
pSeastar = true;
page = 3;
}
if (dinosaur_button.pressed == true) {
pDinosaur = true;
page = 3;
}
if (friedegg_button.pressed == true) {
pFriedegg = true;
page = 3;
}
if (fakebeard_button.pressed == true) {
pFakebeard = true;
page = 3;
}
}
//////////////////333333333 BLACK MARKET LUNG //////////////////////////
else if (page == 3) {
//text
int g = 50;
int h = 20;
int j = 375;
int k = 65;
textFont(font);
text("trace your way in between the dangerous black market organ harvesters to collect your left lung", g, 60, width-2*g, 300);
textFont(small);
text("by dragging your cursor from the left to your lung on the right", h, 108, width - 2*h, 150);
letters = "";
//field image;
image(field, -15, 150);
//lung button
lung_button.update();
lung_button.display();
if(mousePressed == true) {
cursor(HAND);
color c = get(mouseX, mouseY);
println(c);
if (c == -5251099) {
}
else {
if (lung_button.over == false) {
page = 20;
}
}
if (pSeastar == true) {
image(seastar, mouseX-25, mouseY-25, 50, 50);
}
if (pDinosaur == true) {
image(dinosaur, mouseX-15, mouseY-36, 30, 72);
}
if (pFriedegg == true) {
image(friedegg, mouseX-25, mouseY-25, 50, 50);
}
if(pFakebeard == true) {
image(fakebeard, mouseX-30, mouseY-2, 60, 40);
}
}
else {
cursor(MOVE);
if (pSeastar == true) {
image(seastar, mouseX-25, mouseY-25, 50, 50);
}
if (pDinosaur == true) {
image(dinosaur, mouseX-15, mouseY-36, 30, 72);
}
if (pFriedegg == true) {
image(friedegg, mouseX-25, mouseY-25, 50, 50);
}
if(pFakebeard == true) {
image(fakebeard, mouseX-30, mouseY-2, 60, 40);
}
}
}
////////////////////4444444 SPINE //////////////////////////
else if ( page == 4) {
//text
int g = 110;
int h = 40;
textFont(font);
text("excellent! now straighten out your spine", g, 60, width-2*g, 150);
textFont(small);
text("by clicking and dragging each disc into line", h, 83, width - 2*h, 150);
int j = 150;
spineA_button.update2();
spineB_button.update2();
spineC_button.update2();
spineD_button.update2();
int x1 = 276;
int y1 = 152;
int x2 = 252;
int y2 = 340;
for(int i=0; i<=10; i++) {
float x = lerp(x1, x2, i/10.0);
float y = lerp(y1, y2, i/10.0);
ellipse(x, y, 2, 2);
}
if (mousePressed == true){
}
if(mousePressed == false) {
if (moveA == false){
spineA_button.display();
} else {
image(spineA, 250, j +147);
}
if (moveB == false) {
spineB_button.display();
} else {
image(spineB, 252, j +104);
}
if (moveC == false) {
spineC_button.display();
} else {
image(spineC, 255, j +55);
}
if (moveD = false) {
spineD_button.display();
} else {
image(spineD, 260, j);
}
}
}
////////////////////55555555555 BRAIN //////////////////////////
else if (page ==5) {
//text
int g = 40;
int h = 100;
textFont(font);
text("splendid! can you pick out which organ is your brain?", g, 60, width-2*g, 150);
textFont(small);
text("click and hold to check; let go to select", h, 83, width - 2*h, 150);
// images
int x = mouseX;
int r1 = 180;
int r2 = 240;
int r3 = int(random(1-10));
if(mousePressed == true) {
if (x < 77) {
image(pupil, 20, mouseY + 20);
}
else if (x > 77 && x < 178) {
image(gums, 80, height-mouseY );
}
else if (x > 178 && x < 276) {
image(heart, 180, height-mouseY );
}
else if (x > 276 && x < 360) {
image(largeintestine, 278, height-mouseY + 10);
}
else if (x > 360 && x < 458) {
image(brain, 362, height-mouseY);
}
else if (x > 458) {
image(liver, 460, height-mouseY + 5);
}
} else {
image(pupil2, 20 + r3, random(r1, r2));
image(gums2, 80 + r3, random(r1, r2));
image(heart2, 180 + r3, random(r1, r2) );
image(largeintestine2, 278 + r3, random(r1, r2));
image(brain2, 362 + r3, random(r1, r2));
image(liver2, 460 + r3, random(r1, r2));
}
}
////////////////////6666666666666 HEART //////////////////////////
else if (page ==6) {
//text
int g = 140;
int h = 100;
textFont(font);
text("great! how about your heart?", g, 60, width-2*g, 150);
textFont(small);
text("click and hold to check; let go to select", h, 83, width - 2*h, 150);
// images
int x = mouseX;
int r1 = 180;
int r2 = 240;
int r3 = int(random(1-10));
println(mouseX);
int y = int (mouseY + r3);
int y2 = constrain(mouseY, 118, 250);
if(mousePressed == true) {
if (x < 139) {
image(largeintestine, 60 + r3, y);
}
else if (x > 139 && x < 259) {
image(liver, 150 + r3, y);
}
else if (x > 259 && x < 363) {
image(heart, 270 + r3, y);
}
else if (x > 363 && x < 428) {
image(pupil, 370 + r3, y);
}
else if (x > 428) {
image(gums, 440 + r3, y);
}
} else {
image(largeintestine2, 60, height-y2);
image(liver2, 150, y2 +20);
image(heart2, 270, height- y2 - 40);
image(pupil2, 370, y2 + 80);
image(gums2, 440, height- y2 - 10);
}
}
////////////////////77777777777777 SCRAMBLE //////////////////////////
else if (page ==7) {
//text
int g = 40;
int h = 100;
textFont(font);
text("almost there! can you unscramble the rest?", g, 60, width-2*g, 150);
textFont(small);
text("type in each answer and then press enter", h, 83, width - 2*h, 150);
//images
int x = 40;
int y = 150;
println(mouseX + "," + mouseY);
image(pupil2, x, y+15);
image(gums2, x-12, y + 110, 90, 70);
image(largeintestine2, x + 230, y);
image(liver2, x+ 225, y+ 110, 90,70);
//lines
x = 130;
y = 218;
int dx = 260;
int dy = 110;
int l = 150;
int a = 30;
int b = 40;
line(x, y, x +l-30, y);
line(x, y+dy, x+l-30, y+ dy);
line(x+dx-22, y, x + dx +l+22, y);
line(x+dx-22, y+dy, x+dx+l+22, y+dy);
textFont(font);
textAlign(LEFT);
text("luppi", x + a, y-b);
textFont(small);
fill(208, 0, 18);
text(s_pupil, x + a, y-4);
textAlign(CENTER);
fill(0);
}
////////////////////88888888 SCRAMBLE //////////////////////////
else if (page ==8) {
//text
int g = 40;
int h = 100;
textFont(font);
text("almost there! can you unscramble the rest?", g, 60, width-2*g, 150);
textFont(small);
text("type in each answer and then press enter", h, 83, width - 2*h, 150);
//images
int x = 40;
int y = 150;
image(pupil2, x, y+15);
image(gums2, x-12, y + 110, 90, 70);
image(largeintestine2, x + 230, y);
image(liver2, x+ 225, y+ 110, 90,70);
//lines
x = 130;
y = 218;
int dx = 260;
int dy = 110;
int l = 150;
int a = 30;
int b = 40;
line(x, y, x +l-30, y);
line(x, y+dy, x+l-30, y+ dy);
line(x+dx-22, y, x + dx +l+22, y);
line(x+dx-22, y+dy, x+dx+l+22, y+dy);
textFont(font);
textAlign(LEFT);
text("luppi", x + a, y-b);
text("ugsm", x + a + 5, y+dy-b);
textFont(small);
fill(208, 0, 18);
text(s_pupil, x + a, y-4);
text(s_gums, x + a + 3, y+dy-4);
textAlign(CENTER);
fill(0);
}
////////////////////9999999 SCRAMBLE //////////////////////////
else if (page == 9) {
//text
int g = 40;
int h = 100;
textFont(font);
text("almost there! can you unscramble the rest?", g, 60, width-2*g, 150);
textFont(small);
text("type in each answer and then press enter", h, 83, width - 2*h, 150);
//images
int x = 40;
int y = 150;
println(mouseX + "," + mouseY);
image(pupil2, x, y+15);
image(gums2, x-12, y + 110, 90, 70);
image(largeintestine2, x + 230, y);
image(liver2, x+ 225, y+ 110, 90,70);
//lines
x = 130;
y = 218;
int dx = 260;
int dy = 110;
int l = 150;
int a = 30;
int b = 40;
line(x, y, x +l-30, y);
line(x, y+dy, x+l-30, y+ dy);
line(x+dx-22, y, x + dx +l+22, y);
line(x+dx-22, y+dy, x+dx+l+22, y+dy);
textFont(font);
textAlign(LEFT);
text("luppi", x + a, y-b);
text("ugsm", x + a + 5, y+dy-b);
text("inelegant tires", x + dx, y-b);
textFont(small);
fill(208, 0, 18);
text(s_pupil, x + a, y-4);
text(s_gums, x + a + 3, y+dy-4);
text(s_largeintestine, x + dx, y- 4);
textAlign(CENTER);
fill(0);
}
////////////////////SCRAMBLE END //////////////////////////
else if (page == 10) {
//text
int g = 40;
int h = 100;
textFont(font);
text("almost there! can you unscramble the rest?", g, 60, width-2*g, 150);
textFont(small);
text("type in each answer and then press enter", h, 83, width - 2*h, 150);
//images
int x = 40;
int y = 150;
println(mouseX + "," + mouseY);
image(pupil2, x, y+15);
image(gums2, x-12, y + 110, 90, 70);
image(largeintestine2, x + 230, y);
image(liver2, x+ 225, y+ 110, 90,70);
//lines
x = 130;
y = 218;
int dx = 260;
int dy = 110;
int l = 150;
int a = 30;
int b = 40;
line(x, y, x +l-30, y);
line(x, y+dy, x+l-30, y+ dy);
line(x+dx-22, y, x + dx +l+22, y);
line(x+dx-22, y+dy, x+dx+l+22, y+dy);
textFont(font);
textAlign(LEFT);
text("luppi", x + a, y-b);
text("ugsm", x + a + 5, y+dy-b);
text("inelegant tires", x + dx, y-b);
text("driver woke lover", x + dx, y+dy-b);
textFont(small);
fill(208, 0, 18);
text(s_pupil, x + a, y-4);
text(s_gums, x + a + 3, y+dy-4);
text(s_largeintestine, x + dx, y- 4);
text(s_overworkedliver, x + dx, y + dy -4);
textAlign(CENTER);
fill(0);
}
//////////////CONGRATS!!
else if (page == 11) {
/////text centering stuff
int g = 60;
int h = 40;
int j = 80;
int k = 0;
textFont(bigger);
fill(57, 76, 142);
image(congrats, g, 120);
textFont(big);
text("you've won back all your organs!", h, 175, width-2*h, 200);
fill(0);
textFont(small);
text("play again? press 'x' to start again.", j, 340, width- 2*j, 200);
}
////////////// Start Page
else if (page == 0) {
int g = 40;
int h = 140;
textFont(bigger);
fill(29, 71, 126);
image(leaves, 250, 40);
textAlign(RIGHT);
image(start, g, 90);
textFont(small);
fill( 0);
textAlign(LEFT);
text("click to continue", h, 330, width - 2*h, 300);
textAlign(CENTER);
textFont(font);
}
////////////////////202020202022020 OOOPS//////////////////////////
else if (page ==20) {
//clear cursors
pSeastar = false;
pDinosaur = false;
pFriedegg = false;
pFakebeard = false;
//text
int g = 120;
int h = 40;
int j = 80;
int k = 0;
textFont(bigger);
text("UH OH!", g, 160, width-2*g, 300);
textFont(small);
text("(press 'q' to retry.)", j, 275, width- 2*j, 200);
}
}
void keyPressed() {
if (page == 1) {
if ((key == ENTER) || (key == RETURN)) {
println(letters);
page = 2;
}
else if ((key > 31) && (key != CODED)) {
// If the key is alphanumeric, add it to the String
letters = letters + key;
}
else if ((key == DELETE) || (key == BACKSPACE) && (letters.length() > 0)) {
letters = letters.substring(0, letters.length()-1);
}
}
if (page == 7) {
if ((key == ENTER) || (key == RETURN)) {
s_pupil = s_pupil.toLowerCase();
println(s_pupil);
if (s_pupil.equals("pupil")) {
page = 8;
}
}
else if ((key > 31) && (key != CODED)) {
s_pupil = s_pupil + key;
}
else if ((key == DELETE) || (key == BACKSPACE) && (s_pupil.length() > 0)) {
s_pupil = s_pupil.substring(0, s_pupil.length()-1);
}
}
if (page == 8) {
if ((key == ENTER) || (key == RETURN)) {
s_gums = s_gums.toLowerCase();
println(s_gums);
if (s_gums.equals("gums")) {
page = 9;
}
}
else if ((key > 31) && (key != CODED)) {
s_gums = s_gums + key;
}
else if ((key == DELETE) || (key == BACKSPACE) && (s_gums.length() > 0)) {
s_gums = s_gums.substring(0, s_gums.length()-1);
}
}
if (page == 9) {
if ((key == ENTER) || (key == RETURN)) {
s_largeintestine = s_largeintestine.toLowerCase();
println(s_largeintestine);
if (s_largeintestine.equals("large intestine")) {
page = 10;
}
}
else if ((key > 31) && (key != CODED)) {
s_largeintestine = s_largeintestine + key;
}
else if ((key == DELETE) || (key == BACKSPACE) && (s_largeintestine.length() > 0)) {
s_largeintestine = s_largeintestine.substring(0, s_largeintestine.length()-1);
}
}
if (page == 10) {
if ((key == ENTER) || (key == RETURN)) {
s_overworkedliver = s_overworkedliver.toLowerCase();
println(s_overworkedliver);
if (s_overworkedliver.equals("overworked liver")) {
page = 11;
}
}
else if ((key > 31) && (key != CODED)) {
s_overworkedliver = s_overworkedliver + key;
}
else if ((key == DELETE) || (key == BACKSPACE) && (s_overworkedliver.length() > 0)) {
s_overworkedliver = s_overworkedliver.substring(0, s_overworkedliver.length()-1);
}
}
if (page == 11) {
if ((key == 'Q') || (key == 'q')) {
page = 1;
}
}
//delete me after you get page 4 to work
if (key == '1') {
page = 1;
} else if (key == '2') {
page = 2;
} else if (key == '3') {
page = 3;
} else if (key == '4') {
page = 4;
} else if (key == '5') {
page = 5;
} else if (key == '6') {
page = 6;
} else if (key == '7') {
page = 7;
} else if (key == '8') {
page = 8;
} else if (key == '9') {
page = 9;
} else if (key == '0') {
page = 10;
}
else {
if ((key == 'Q') || (key == 'q')) {
page = 2;
}
if ((key == 'X') || (key == 'x')) {
page = 0;
}
}
}
void mousePressed() {
cursor(HAND);
if (page == 0) {
page =1;
}
if (page == 4) {
println("pressed");
spineB_button.update();
spineC_button.update();
spineD_button.update();
int j = 150;
if (mouseY > j + 147) {
moveA = true;
}
if (mouseY > j + 104 && mouseY < j+ 147) {
moveB = true;
}
if (mouseY > j + 104 && mouseY < j + 55) {
moveC = true;
}
if (mouseY > j + 55) {
moveD = true;
}
}
}
void mouseReleased() {
if (page == 3) {
if (lung_button.over == true){
page = 4;
}
}
if (page == 4) {
int j = 150;
if (mouseY > j + 147 && mouseX < 255 && mouseX > 245) {
if (moveA == true) {
println("yes");
// image(spineA, 250, j +147);
}
}
if (moveB == true) {
if (mouseY > j + 104 && mouseY < 147 && mouseX < 257 && mouseX > 247) {
// image(spineB, 252, j +104);
}
}
if (moveC == true) {
if (mouseY > j + 55 && mouseY < 104 && mouseX < 260 && mouseX > 250) {
// image(spineC, 255, j +55);
}
}
if (moveD == true) {
if (mouseY > j && mouseY < j+55 && mouseX < 265 && mouseX > 255) {
// image(spineD, 260, j);
}
}
if (moveA == true && moveB == true && moveC == true && moveD ==true) {
page =5;
moveA = false;
moveB = false;
moveC = false;
moveD = false;
}
}
if ((page == 5) && (mouseX > 360) && (mouseX < 458)) {
page =6;
}
if ((page == 6) && (mouseX> 259) && (mouseX< 363)) {
page =7;
}
}
void mouseDragged() {
if (page ==4) {
println(mouseY + "," + mouseX);
int j = 150;
if (mouseY > j + 147) {
image (spineA, mouseX, j + 147);
moveA = true;
}
if ((mouseY > j + 104) && (mouseY < j +147)) {
image (spineB, mouseX, j + 104);
moveB = true;
}
if ((mouseY > j + 55) && (mouseY <j + 104)) {
image (spineC, mouseX, j + 55);
moveC = true;
}
if ((mouseY > j) && (mouseY < j + 55)) {
image (spineD, mouseX, j);
moveD = true;
}
}
}
class Button
{
int x, y;
int w, h;
color basecolor, highlightcolor;
color currentcolor;
boolean over = false;
boolean pressed = false;
void pressed() {
if(over && mousePressed) {
pressed = true;
} else {
pressed = false;
}
}
boolean overRect(int x, int y, int width, int height) {
if (mouseX >= x && mouseX <= x+width &&
mouseY >= y && mouseY <= y+height) {
return true;
} else {
return false;
}
}
}
class ImageButtons extends Button
{
PImage base;
PImage roll;
PImage down;
PImage currentimage;
ImageButtons(int ix, int iy, int iw, int ih, PImage ibase, PImage iroll, PImage idown)
{
x = ix;
y = iy;
w = iw;
h = ih;
base = ibase;
roll = iroll;
down = idown;
currentimage = base;
}
void update()
{
over();
pressed();
if(pressed) {
currentimage = down;
} else if (over){
currentimage = roll;
} else {
currentimage = base;
}
}
void update2()
{
over();
pressed();
if(pressed) {
currentimage = down;
} else if (over){
currentimage = roll;
} else {
currentimage = base;
}
}
void over()
{
if( overRect(x, y, w, h) ) {
over = true;
} else {
over = false;
}
}
void display()
{
image(currentimage, x, y);
}
}
Tiffany - Project 1
on Wednesday, Oct 29, 2008 – 5:12 am
One Comment
It looks great Tiffany! Very interesting idea and neat graphics! I’m so proud of you Tiffany, even though I kind of forgot how to program myself.