// This is a question from a book that I read, and it can test out what you value the most in your life.
PFont font;
String letters= " ";
String a= "Answer the following question to see what you value the most in your life. (Enter 'go' to read the question.)";
int back= 100;
void setup() {
size(400, 400);
font= loadFont("AmericanTypewriter-48.vlw");
textFont(font);
textAlign(CENTER);
textSize(24);
}
void draw() {
background(back);
stroke(255);
strokeWeight(1);
line(100, 350, 300, 350);
text(letters, 200, 350);
text(a, 50, 30, 300, 300);
}
void keyPressed() {
if (key == ENTER) {
letters= letters.toLowerCase();
println(letters);
if (letters.equals("go")) {
back= 0;
fill(255);
// Question
a= "You live in a forest with your animals. One day, the forest is on fire and you can save only one animal to leave the forest with you. Which of the following animals would you save: tiger, sheep, cow, horse, and peacock.";
} else if (letters.equals("tiger")) { // Answer for choosing tiger
back= 255;
textSize(47);
fill(100);
a= "Saving the 'tiger' means that you value 'power' the most in your life.";
} else if (letters.equals("sheep")) { // Answer for choosing sheep
back=100;
fill(50);
textSize(47);
a= "Saving the 'sheep' means that you value 'love' the most in your life.";
} else if (letters.equals("cow")) { // Answer for choosing cow
back= 50;
fill(200);
textSize(47);
a= "Saving the 'cow' means that you value 'work' the most in your life.";
} else if (letters.equals("horse")) { // Answer for choosing horse
back= 200;
fill(100);
textSize(47);
a= "Saving the 'horse' means that you value freedom the most in your life.";
} else if (letters.equals("peacock")) { // Answer for choosing peacock
back= 100;
fill(0);
textSize(48);
a= "By saving the 'peacock', you value 'money' the most in your life.";
}
letters= "";
}else if ((key > 31) && (key != CODED)) {
letters= letters + key;
}
}Charlene - G
on Thursday, Oct 16, 2008 – 6:21 pm
One Comment
hi. i like this program because it incoorporates psychology. One area of improvement would to be add a keypress function of a key that allows the user to “reset” the program