Skip to content

Instantly share code, notes, and snippets.

@slambert
Created September 15, 2015 16:41
Show Gist options
  • Save slambert/2f07c0f434ebd0f7963c to your computer and use it in GitHub Desktop.
Save slambert/2f07c0f434ebd0f7963c to your computer and use it in GitHub Desktop.
Done with an IF/ELSE statement
/*
Steve Lambert
Super Stunning Psychedelic Booleans
September 15, 2015 v0.2
Done with an IF/ELSE statement
*/
void setup(){
size(800,600); // how big it is, you know this.
println("Welcome to Steve's Psychedelic Light Show");
println("Width: " + width); // dumb question, dumb answer
} // end setup
void draw(){
background(250); // dull
// THIS WORKS
if (mouseX <= width/4 ) { // if we go to the left quarter
// then do this:
background(255,0,0); // paint the town red
println("X: " + mouseX);
}
else /* otherwise... */ if (mouseX >= (width/4 * 3)) {
background(0,0,255); // paint the town blue
}
/* if none of the above is true, forget I mentioned it at all and go back to what you were doing */
} // end draw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment