Advertisement
LucidSigma

Algicosathlon Scoreboard Source Code (Processing 3.0.1)

Mar 11th, 2016
4,072
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.47 KB | None | 1 0
  1. float[] changingLocations = {26, 74, 122, 170, 218, 266, 314, 362, 410, 458, 506, 554, 602, 650, 698, 746, 794, 842};
  2. int[] newLocations = {842, 794, 746, 698, 650, 602, 554, 506, 458, 410, 362, 314, 266, 218, 170, 122, 74, 26};
  3. int[] permaLocations = {26, 74, 122, 170, 218, 266, 314, 362, 410, 458, 506, 554, 602, 650, 698, 746, 794, 842};
  4.  
  5. int[] redValue = {31, 0, 150, 0, 128, 0, 0, 128, 255, 204, 255, 128, 255, 247, 160, 255, 210, 255};
  6. int[] greenValue = {117, 255, 75, 173, 128, 255, 0, 128, 88, 204, 191, 0, 0, 127, 32, 0, 180, 255};
  7. int[] blueValue = {254, 255, 0, 67, 128, 0, 128, 0, 0, 255, 0, 0, 255, 190, 240, 0, 140, 0};
  8.  
  9. float[] changingScores = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  10. int[] newScores = {1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 25, 30, 40, 50, 60, 75, 100};
  11.  
  12. float[] changingExtensions = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5};
  13. float[] newExtensions = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  14.  
  15. String[] names = {"Blue", "Cyan", "Brown", "Green", "Grey", "Lime", "Navy", "Olive", "Orange", "Lavender", "Gold", "Maroon", "Magenta", "Pink", "Purple", "Red", "Tan", "Yellow"};
  16. String placeHolder;
  17.  
  18. float[] locationIncrements = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  19. float[] scoreIncrements = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  20. float[] extensionsIncrements = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  21.  
  22. int redIncrease = 0;
  23. int numberOfPlayers = 18;
  24.  
  25. boolean extension = true;
  26. boolean movement = true;
  27. boolean elimination = true;
  28. boolean beginExtension = false;
  29. boolean beginMovement = false;
  30. boolean beginElimination = false;
  31.  
  32. void setup() {
  33.   size(1600, 900);
  34.   frameRate(60);
  35.   background(0);
  36.  
  37.   for(int i = 0; i < numberOfPlayers; i++){
  38.     locationIncrements[i] = (float(newLocations[i]) - changingLocations[i]) / 300;
  39.     scoreIncrements[i] = (float(newScores[i]) - changingScores[i]) / 300;
  40.     newExtensions[i] = (1050.0 / 100.0) * float(newScores[i]);
  41.     extensionsIncrements[i] = newExtensions[i] / 300;
  42.   }
  43. }
  44.  
  45. void draw() {
  46.   background(0);
  47.   fill(75);
  48.   noStroke();
  49.   rect(-1, -1, 251, 1601);
  50.   fill(255);
  51.   textSize(32);
  52.   textAlign(RIGHT, BOTTOM);
  53.  
  54.   for(int i = 0; i < numberOfPlayers; i++){
  55.     switch(i){
  56.       case 0:  placeHolder = "st";
  57.                break;
  58.       case 1:  placeHolder = "nd";
  59.                break;
  60.       case 2:  placeHolder = "rd";
  61.                break;
  62.       default: placeHolder = "th";
  63.     }
  64.     text((i + 1) + placeHolder, 80, permaLocations[i] + 34);
  65.   }
  66.  
  67.   for(int i = 0; i < numberOfPlayers; i++){
  68.     fill(255);
  69.     textAlign(LEFT, BOTTOM);
  70.     text(int(changingScores[i]), 260 + changingExtensions[i], changingLocations[i] + 34);
  71.     textAlign(RIGHT, BOTTOM);
  72.     fill(redValue[i], greenValue[i], blueValue[i]);
  73.     rect(250, changingLocations[i], changingExtensions[i], 32);
  74.     text(names[i], 235, changingLocations[i] + 33);
  75.   }
  76.  
  77.   if(beginExtension == true){
  78.     for(int i = 0; i < numberOfPlayers; i++){
  79.       if(changingScores[i] + scoreIncrements[i] < newScores[i]){
  80.         changingScores[i] = changingScores[i] + scoreIncrements[i];
  81.       }else{
  82.         changingScores[i] = newScores[i];
  83.       }
  84.       if(changingExtensions[i] + extensionsIncrements[i] < newExtensions[i]){
  85.         changingExtensions[i] = changingExtensions[i] + extensionsIncrements[i];
  86.       }else{
  87.         changingExtensions[i] = newExtensions[i];
  88.       }
  89.     }
  90.   }
  91.  
  92.   if(beginMovement == true){
  93.     for(int i = 0; i < numberOfPlayers; i++){
  94.       if(locationIncrements[i] > 0){
  95.         if(changingLocations[i] + locationIncrements[i] < newLocations[i] + 1){
  96.          changingLocations[i] = changingLocations[i] + locationIncrements[i];
  97.         }
  98.       }
  99.      
  100.       if(locationIncrements[i] < 0){
  101.         if(changingLocations[i] + locationIncrements[i] > newLocations[i] + 1){
  102.          changingLocations[i] = changingLocations[i] + locationIncrements[i];
  103.         }
  104.       }
  105.     }
  106.   }
  107.  
  108.   if(beginElimination == true){
  109.     fill(redIncrease, 0, 0);
  110.     textAlign(LEFT, BOTTOM);
  111.     text("ELIMINATED", 300, 842 + 34);
  112.     if(redIncrease < 256){
  113.       redIncrease += 1;
  114.     }
  115.   }
  116. }
  117.  
  118. void keyPressed() {
  119.   if(key == '1' && extension == true){
  120.     beginExtension = true;
  121.     extension = false;
  122.   }else if(key == '2' && movement == true){
  123.     beginMovement = true;
  124.     movement = false;
  125.   }else if(key == '3' && elimination == true){
  126.     beginElimination = true;
  127.     elimination = false;
  128.   }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement