Scott - F

By Scott
/* I appreciate concrete answers. I tried to therefore create the most objective ABCDE book possible, while still trying to have some fun. */ char mode = 'x'; PFont mainFont; PImage above; PImage below; PImage closer; PImage distant; PImage elevated; void setup() { size(400, 400); smooth(); noStroke(); noFill(); // load font mainFont = loadFont("main.vlw"); // load A img above = loadImage("above.png"); // load B img below = loadImage("below.png"); // load C img closer = loadImage("closer.png"); // load D img distant = loadImage("distant.png"); // load E img elevated = loadImage("elevated.png"); } void draw() { background(34); if (mode == 'x') { textFont(mainFont); textSize(36); fill(255); text("Hit H for Home", mouseX, mouseY-40); text("Hit A - E", mouseX, mouseY); // mode a } else if(mode == 'a') { image(above, 0, 0); textFont(mainFont); textSize(36); if (mouseY <= 336) { fill(255); text("A = above", mouseX, mouseY); } else { textSize(14); fill(177); text("no no...", mouseX, mouseY); } // mode b } else if(mode == 'b') { image(below, 0, 0); fill(255); textFont(mainFont); textSize(36); if (mouseY >= 111) { text("B = below", mouseX, mouseY); } else { fill(177); textFont(mainFont); textSize(24); text("no no...", mouseX, mouseY); } // mode c } else if(mode == 'c') { image(closer, 0, 0); if (mouseX <= 200 && mouseY <=205) { fill(255); textFont(mainFont); textSize(24); text("C = close", mouseX, mouseY); } else { fill(177, 0, 0); textFont(mainFont); textSize(24); text("Put it closer", mouseX, mouseY); } // mode d } else if(mode == 'd') { image(distant, 0, 0); if (mouseY <= 193) { fill(55, 55, 72); textFont(mainFont); textSize(map(mouseY,0,height,0,100)); text("D = distant", mouseX, mouseY); } // mode e } else if(mode == 'e') { image(elevated, 0, 0); if (mouseY < 176) { fill(255); textFont(mainFont); textSize(25); text("E = elevated", 124, mouseY); } } } void keyPressed() { if (key == 'a' || key == 'A') { // if the key is a or A mode = 'a'; // run mode a } else if (key == 'b' || key == 'B') { // otherwise if the key is b or B mode = 'b'; // run mode b } else if (key == 'c' || key == 'C') { mode = 'c'; } else if (key == 'd' || key == 'D') { mode = 'd'; } else if (key == 'e' || key == 'E') { mode = 'e'; } else if (key == 'h' || key == 'H') { // if the key is h or H, run mode x mode = 'x'; } }

3 Comments

  1. Cindy Chi
    Posted October 15, 2008 at 3:53 pm | Permalink

    i like the simplicity of this. pretty neat idea too!!! =)

  2. Posted October 16, 2008 at 11:16 am | Permalink

    Excellent! The ideas are communicated through the relationships between elements and the cursor.

  3. wangl
    Posted October 20, 2008 at 11:18 am | Permalink

    very good. simple communication. works well

Post a Comment

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

*
*