Skip to content

Instantly share code, notes, and snippets.

@dinarname
Created October 20, 2018 12:04
Show Gist options
  • Save dinarname/8082673a62800075e7ed76a34d6dab35 to your computer and use it in GitHub Desktop.
Save dinarname/8082673a62800075e7ed76a34d6dab35 to your computer and use it in GitHub Desktop.
duel on the keyboard
int count = 3;
void setup (){
size(800, 800);
frameRate(60);
}
void draw(){
if (count >= 1){
background(0);
textSize(30);
text(count, 350, 350);
delay(1000);
count--;
} else if((count < 1) && (count >= 0)){
background(#5DF2D8);
text("Go !!", 350, 350);
}
if (keyPressed == true){
if (key == 'A' || key == 'a'){
background(#825DF2);
text("Left win", 50, 350);
noLoop();
} else if (key == 'L' || key == 'l'){
background(#DE5DF2);
text("Right Win", 600, 350);
noLoop();
}
}
}
void mousePressed() {
count = 3;
loop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment