Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. int turn=1;
  2. float t1=30.0,t2=30.0, m1,m2;
  3.  
  4. void setup()
  5. {
  6. fullScreen(1);
  7. }
  8.  
  9. void button(int n)
  10. {
  11. if(n==1)
  12. {
  13. if(turn==1)
  14. {
  15. m2=millis();
  16. t2=30.0;
  17. t1=30-(millis()-m1)/1000;
  18. if(t1<0){fill(255,0,0);}else{fill(0,255,0);}
  19. if(mouseY>0&&mouseY<height/3){turn=2;}
  20. }
  21. else{fill(150);}
  22. rect(0,0,width,height/3);
  23. }
  24. if(n==2)
  25. {
  26.  
  27. if(turn==2)
  28. {
  29. m1=millis();
  30. t2=30-(millis()-m2)/1000;
  31. t1=30.0;
  32.  
  33. if(mouseY>height-height/3&&mouseY<height){turn=1;}
  34. if(t2<0){fill(255,0,0);}else{fill(0,255,0);}
  35. }
  36. else{fill(150);}
  37. rect(0,height-height/3,width,height/3);
  38.  
  39. }
  40. fill(255);
  41. }
  42. void draw()
  43. {
  44. background(0);
  45. rect(0,height/2-height/96,width,height/48);
  46. button(1);
  47. button(2);
  48. textAlign(CENTER,CENTER);
  49. textSize(100);
  50.  
  51. pushMatrix();
  52. translate(width/2,height/2-height/12);
  53. rotate(radians(180));
  54. text(nf(t1,2,2),0,0);//width/2,height/2-height/12);
  55. popMatrix();
  56. text(nf(t2,2,2),width/2,height/2+height/12);
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement