NelIfandieva

Zarche_I

Feb 5th, 2020
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int side = int(random(1, 4));
  2. int diceSize = 300;
  3.  
  4. String answer = "";
  5. String correctAnswer = "13";
  6.  
  7. void setup(){
  8.   size(1200, 800);
  9.   frameRate(20);
  10.   //noLoop();
  11. }
  12.  
  13. void draw(){
  14.   background(255);
  15.  
  16.   fill(#FC0505);
  17.   rectMode(CENTER);
  18.   rect(950, 300, diceSize, diceSize, diceSize/5);
  19.  
  20.   fill(50);  
  21.   side = int(random(1, 4));
  22.  
  23.   if(side == 1){
  24.     ellipse(950, 300, diceSize / 5, diceSize / 5);
  25.   }else if(side == 2){
  26.     ellipse(950 - diceSize / 4, 300 - diceSize / 4, diceSize / 5, diceSize / 5);
  27.     ellipse(950 + diceSize / 4, 300 + diceSize / 4, diceSize / 5, diceSize / 5);
  28.   }else if(side == 3){
  29.     ellipse(950 - diceSize / 4, 300 - diceSize / 4, diceSize / 5, diceSize / 5);
  30.     ellipse(950, 300, diceSize / 5, diceSize / 5);
  31.     ellipse(950 + diceSize / 4, 300 + diceSize / 4, diceSize / 5, diceSize / 5);
  32.   }
  33.  
  34.   if(mousePressed && mouseButton == LEFT){
  35.     noLoop();
  36.     text("Answer: ", 10, 670);
  37.     if(keyPressed){
  38.       answer = answer + key;
  39.       int textX = "Answer".length() + 2;
  40.       text(answer, textX, 670);
  41.     }
  42.   }
  43. }
RAW Paste Data