SHARE
TWEET

Untitled

a guest Jun 15th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let buttona;
  2. let buttonb;
  3. let truthset = ["say this","say that","say the other thing"];
  4. let dareset = ["do this","do that","do the other thing"];
  5. let pressed = 0;
  6. let spintimer = 0;
  7. let buttonc;
  8.  
  9. let t_or_d = 0;
  10.  
  11.  
  12.  
  13. function setup() {
  14.   createCanvas(1300, 650);
  15.   background(177, 207, 239);
  16.   buttona = createButton('Truth');
  17.   buttona.position(400, 50);
  18.   buttona.mousePressed(changeA);
  19.   buttonb = createButton('Dare');
  20.   buttonb.position(900, 50);
  21.   buttonb.mousePressed(changeB);
  22.   buttonc = createButton('Play Again');
  23.   buttonc.position(width/2-30,height);
  24.   buttonc.mousePressed(playAgain);
  25.   buttonc.hide();
  26. }
  27.  
  28.  
  29. function draw(){
  30.   print(pressed);
  31.   textSize(32);
  32.   fill(255,0,0);
  33.   text('or', 650, 65);
  34.   fill(0, 102, 153);
  35.   line(0, 100, 1300, 100);
  36.   ellipse(650,325,350,350);
  37.   fill(247, 111, 147)
  38.  
  39.   // then rotate the grid around the pivot point by a
  40.   // number of degrees equal to the frame count of the sketch
  41.   if(pressed == 0){
  42.     buttonc.hide();
  43.     noStroke();
  44.     fill(177, 207, 239);
  45.     rect(10,275,350,75);
  46.     noStroke();
  47.     fill(177, 207, 239);
  48.     rect(900,275,350,75);
  49.     push();
  50.     translate(650,325);
  51.     rotate(radians(frameCount));
  52.     spintimer = frameCount;
  53.     print(spintimer);
  54.     stroke(0);
  55.     line(0,-175,0,175);
  56.     line(-175,0,175,0);
  57.     line(123.744,123.744,-123.744,-123.7443);
  58.     line(-123.744,123.744,123.744,-123.744);
  59.     pop();
  60.   }
  61.  
  62.   if (pressed == 1){
  63.     print(spintimer);
  64.     push();
  65.     translate(650,325);
  66.     rotate(radians(frameCount));
  67.     stroke(0);
  68.     line(0,-175,0,175);
  69.     line(-175,0,175,0);
  70.     line(123.744,123.744,-123.744,-123.7443);
  71.     line(-123.744,123.744,123.744,-123.744);
  72.     pop();
  73.   }
  74.  
  75.   if(frameCount == spintimer + 100){
  76.      pressed = 3;
  77.   }
  78.  
  79.   if (pressed == 3 && t_or_d == 1){
  80.  
  81.     noStroke();
  82.     fill(177, 207, 239);
  83.     rect(10,275,350,75);
  84.     fill(0);
  85.     var rand = truthset[Math.floor(Math.random() * truthset.length)];
  86.     textSize(32);
  87.     text(rand, 50, 325);
  88.     pressed = pressed+1;
  89.   }
  90.   if (pressed == 3 && t_or_d == 2){
  91.  
  92.     noStroke();
  93.     fill(177, 207, 239);
  94.     rect(900,275,350,75);
  95.     fill(0);
  96.     var rand = dareset[Math.floor(Math.random() * dareset.length)];
  97.     textSize(32);
  98.     text(rand, 1000, 325);
  99.     pressed = pressed+1;
  100.   }
  101.   if (pressed == 4){
  102.     push();
  103.     translate(650,325);
  104.     stroke(0);
  105.     line(0,-175,0,175);
  106.     line(-175,0,175,0);
  107.     line(123.744,123.744,-123.744,-123.7443);
  108.     line(-123.744,123.744,123.744,-123.744);
  109.  
  110.     buttonc.show();
  111.   }
  112.  
  113. }
  114.  
  115. function changeA(){
  116.   pressed=pressed+1;
  117.   t_or_d=1;
  118.  
  119. }
  120.  
  121. function changeB(){
  122.   pressed = pressed +1;
  123.   t_or_d=2;
  124.  
  125. }
  126.  
  127. function playAgain(){
  128.   pressed = 0;
  129. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top