Beth - G

By Elizabeth
/*This is a test to see what type of gum you are! Answer yes or no to the following questions to find out what type of gum you are! *This test is based off a quiz I took online.* */ PFont font; String question = "Answer yes or no to the \nfollowing questions to \nfind out what type of gum \nyou are. \n(Type 'chew' to start!)"; //String question = "hello"; String answer = ""; int back = 150; void setup() { size(400, 400); font = loadFont("MyriadPro-Semibold-48.vlw"); textFont(font); //textAlign(CENTER); textSize(30); println(question); } void draw() { background(back); stroke(255); strokeWeight(1); text(question, 20, 60); text(answer, 20, 380); } void keyPressed() { if (key == ENTER) { answer = answer.toLowerCase(); println(answer); //Print to console to see input if (answer.equals("chew")) { back = 0; fill(255); //question = ""; question = "Do people smile when \nyou breath on them?"; } else if (answer.equals("yes")) {//answer for winterfresh back= 255; textSize(54); fill(50); //question = ""; question = "Yes! You are so \nfresh and so \nclean like \nWinterfresh \nGum!"; } else if (answer.equals("no")) { back = 100; fill(20); textSize(42); //question = ""; question = "NO? Then you\nmust be \nJuicy Fruit Gum\n...that gotta \nhave sweet \ngotta have juicy!"; } else { back = 200; //question = ""; question = "Yes or No \nonly please :) "; textSize(60); } answer = ""; //Clear the variable println(question); } else if ((key > 31) && (key != CODED)) { // If the key is alphanumeric, add it to the string answer = answer + key; } }

Post a Comment

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

*
*