Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int turn=1;
- float t1=30.0,t2=30.0, m1,m2;
- void setup()
- {
- fullScreen(1);
- }
- void button(int n)
- {
- if(n==1)
- {
- if(turn==1)
- {
- m2=millis();
- t2=30.0;
- t1=30-(millis()-m1)/1000;
- if(t1<0){fill(255,0,0);}else{fill(0,255,0);}
- if(mouseY>0&&mouseY<height/3){turn=2;}
- }
- else{fill(150);}
- rect(0,0,width,height/3);
- }
- if(n==2)
- {
- if(turn==2)
- {
- m1=millis();
- t2=30-(millis()-m2)/1000;
- t1=30.0;
- if(mouseY>height-height/3&&mouseY<height){turn=1;}
- if(t2<0){fill(255,0,0);}else{fill(0,255,0);}
- }
- else{fill(150);}
- rect(0,height-height/3,width,height/3);
- }
- fill(255);
- }
- void draw()
- {
- background(0);
- rect(0,height/2-height/96,width,height/48);
- button(1);
- button(2);
- textAlign(CENTER,CENTER);
- textSize(100);
- pushMatrix();
- translate(width/2,height/2-height/12);
- rotate(radians(180));
- text(nf(t1,2,2),0,0);//width/2,height/2-height/12);
- popMatrix();
- text(nf(t2,2,2),width/2,height/2+height/12);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement