NelIfandieva

Zarche_3

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