xxxxxxxxxx
char letter = 'a';
float xPos, yPos;
color col;
int score;
int time;
void setup(){
size(500, 500);
time = 30000; //ms
xPos = width/2;
yPos = height/2;
col = color(255, 255, 255);
background(0, 50, 50);
}
void draw(){
fill(0, 50, 50);
rect(0, 0, width, height);
fill(col);
textSize(30);
text(letter, xPos, yPos);
print(letter);
textAlign(LEFT, CENTER);
text(score, width * 0.05, height * 0.95);
float timeRemaining = (time - millis()) * 0.001;
text(nf(timeRemaining, 0, 2), width * 0.05, height * 0.05);
if (time - millis() < 1){
exit()
}
}
void keyPressed(){
if(key == letter){
score++
col = color(random(100, 255), random(100,255), random(100, 255));
letter = char(int(random('a', 'z' + 1))); //cast the random number
xPos = random(10, width - 10);
yPos = random(10, height - 10)
}
}