Yo smart people, I am currently working on a random word generator. The reason for it is to give an objective either every 15 minutes or by key press. For instance “Draw the letter B”.
I got the randomiser, but it is either going too fast, or with delay so slow the program stops running? And also tried the keypress. (Currently has an image as background). I can’t seem to figure out how create a timer the redraws the objective.
Heres the code.
PFont font;
PImage bg;
int n = 0;
void setup() {
size(1920, 1080);
// frameRate(1);
bg = loadImage("backtest.png");
}
void draw() {
//var n = 0;
var o = 0;
var s = 0;
background(bg);
//background(255);
fill(255);
font = loadFont("type1.vlw");
textFont(font);
//arrays, which are int because they varray from 0 to 4
String[] nouns = {"A","B","C","D","E"};
String[] stasis = {"Draw letter"};
String[] objective = {"objective"};
//int n = int (random(5));
//int o = int(random(1));
//delay(50000);
text(nouns[n], 400, 700);
text(stasis[s], 110, 700);
text(objective[o], 110, 650);
}
void keyPressed(){
if ( key == 'r') {
n = 1;
}else{
n = 4;
}
}