• API
• FAQ
• Tools
• Archive
daily pastebin goal
31%
SHARE
TWEET

# Untitled

a guest Oct 19th, 2018 65 Never
ENDING IN00days00hours00mins00secs
1. // The colors we'll be using
2. color red = color(255,0,0);
3. color green = color(0,255,0);
4. color blue = color(0,0,255);
5.
6. // Winning color and it's hue
7. int winHue = 0;
8. color winColor;
9.
10. // Index to pick colors from
11. color[] colors = new color[]{red, green,blue};
12.
13. // Each quadrant's color value index
14. int[] quadrants = new int[4];
15.
16. int midX;
17. int midY;
18.
19. boolean won;
20.
21. void setup() {
22.   // Set size of the canvas
23.   size(800, 600);
24.   println(midX);
25.   println(midY);
26.   // Set each our quadrants to a random color
27.   // Red, Green or Blue
32.
33.   // Set midX and midY
34.   midX = width/2;
35.   midY = height/2;
36.
37.   won = false;
38. }
39.
40. void win() {
41.   colorMode(HSB,255,100,100);
42.   background(color(winHue++ % 255,100,100));
43.   println(winHue);
44. }
45.
46. void draw() {
47.   if (!won) {
51.     rect(0,0,width/2,height/2);
52.
55.     rect(0,height/2,width/2,height/2);
56.
59.     rect(width/2,0,width/2,height/2);
60.
63.     rect(width/2,height/2,width/2,height/2);
64.   } else {
65.    win();
66.   }
67. }
68.
69. void mouseClicked() {
70.   if (!won) {
71.     if (mouseX < midX && mouseY < midY) {
73.     } else if(mouseX < midX && mouseY > midY) {
75.     } else if(mouseX > midX && mouseY < midY) {
77.     } else {