NelIfandieva

Zarche_2

Feb 5th, 2020
109
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. int lengthIndex = 2;
  4. int textX = "Answer".length() + lengthIndex;
  5.  
  6. String answer = "";
  7. String correctAnswer = "13";
  8.  
  9. void setup(){
  10.   size(1200, 800);
  11.   frameRate(20);
  12.   //noLoop();
  13. }
  14.  
  15. void draw(){
  16.   background(255);
  17.  
  18.   fill(#FC0505);
  19.   rectMode(CENTER);
  20.   rect(950, 300, diceSize, diceSize, diceSize/5);
  21.  
  22.   fill(50);  
  23.   side = int(random(1, 4));
  24.  
  25.   if(side == 1){
  26.     ellipse(950, 300, diceSize / 5, diceSize / 5);
  27.   }else if(side == 2){
  28.     ellipse(950 - diceSize / 4, 300 - diceSize / 4, diceSize / 5, diceSize / 5);
  29.     ellipse(950 + diceSize / 4, 300 + diceSize / 4, diceSize / 5, diceSize / 5);
  30.   }else if(side == 3){
  31.     ellipse(950 - diceSize / 4, 300 - diceSize / 4, diceSize / 5, diceSize / 5);
  32.     ellipse(950, 300, diceSize / 5, diceSize / 5);
  33.     ellipse(950 + diceSize / 4, 300 + diceSize / 4, diceSize / 5, diceSize / 5);
  34.   }
  35.  
  36.   if(mousePressed && mouseButton == LEFT){
  37.     noLoop();
  38.     text("Answer: " , 10, 670);
  39.     for(int i = 0; i < 5; i++){
  40.       if(keyPressed){
  41.        answer = answer + key;
  42.        text(key, lengthIndex++, 670);
  43.       }
  44.     }
  45.   }
  46. }
RAW Paste Data