Skip to content

Instantly share code, notes, and snippets.

@slambert
Created March 17, 2020 20:36
Show Gist options
  • Save slambert/b66d5f2f8dc26cbe342e6deb442552fb to your computer and use it in GitHub Desktop.
Save slambert/b66d5f2f8dc26cbe342e6deb442552fb to your computer and use it in GitHub Desktop.
Note: you'll have to add your own images! and size them
/* A sketch that has states
Steve Lambert March 17, 2020
Featuring Columbo!
v.01
*/
float elapsedTime;
float time;
PImage acapulco;
PImage acapulco2;
PImage tape;
void setup(){
size(720,480);
acapulco = loadImage("acapulco.png"); // Load the image into the program
acapulco2 = loadImage("acapulco2.png");
tape = loadImage("tape.png");
elapsedTime = 0;
time = 10000;
} // end setup
void draw(){
elapsedTime = millis() - time; //calculate how much time has passed
println("millis = " + millis());
println("elapsedTime = " + elapsedTime/1000);
println("time = " + time);
if (elapsedTime <= 1000){
println("bingo");
image(acapulco, 0, 0, 720, 480);
} if (elapsedTime >= 1001 && elapsedTime <= 2000 ) {
println("bingo2");
image(acapulco2, 0, 0, 720, 480);
} if (elapsedTime >= 2001 && elapsedTime <= 3000 ) {
println("bingo3");
image(tape, 0, 0, 720, 480);
}
} // end of draw
void mousePressed(){
time = millis();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment