Lena - G

By wangl
//This program programs questions and lets the user dictate the next question by typing answers PFont font; String letters = ""; String answer = ""; void setup() { size(400,400); font= loadFont("Alba-30.vlw"); textFont(font); textAlign(CENTER); } void draw() { background(0); //black background text("Do you like the color Pink?", 200,100);//question one text(letters, 200,300); //size of the text letters text(answer,200,300); //size of the text answers } void keyPressed()//function { if((key == ENTER)|| (key == RETURN)) { letters = letters.toLowerCase(); println(letters);//printing typed letters if(letters.equals("yes"))//if answer is yes, then the { answer = "You must be a girl.";//question is } else { answer = "Then you must be a guy."; //or else, the question is } letters=""; } else if((key > 31) && (key !=CODED)) { letters = letters + key; } }

Post a Comment

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

*
*