Color randomizing time reaction game

// -------------------------------------------------------------------------------
// color constants

final color WHITE  = color(255);
final color BLACK  = color(0);

final color DARKGRAY = color(110); 
final color LIGHTGRAY = color(200); 

final color RED     = color(255, 0, 0);
final color GREEN   = color(0, 255, 0);
final color BLUE    = #0326FF; 

final color YELLOW  = #FFF703; 
final color BROWN = (#B9780D); 

final color[] colList = 
  {
  RED, WHITE, BLUE, RED, YELLOW, GREEN, LIGHTGRAY, BROWN
};

// variables 
int i; 

// -------------------------------------------------------------------------------

void setup() {
  size(600, 600);
  background(200);
}

void draw() {
  background(200);
  fill(colList[i%colList.length]);
  rect(100, 100, 
    200, 200);
}

// -------------------------------------------------------------------------------

void keyPressed() {
  i++;
}
//

Chrisir

1 Like