for paused of the drawing
in
Programming Questions
•
8 months ago
I wanna the program paused when I press the key and the number currently on the screen is immediately stop and appear on the screen.but for my code when the program paused the number disappeared.Can anyone help with my code please
boolean paused = false;
float x, y;
void setup() {
size(800, 600);
background(255);
textFont(createFont("Georgia", 36));
textAlign(CENTER, CENTER);
smooth();
noStroke();
x = width / 3;
y = height / 3;
}
void draw() {
int randomNum = (int) random(24);
fill(204, 120);
rect(0, 0, width, height);
if (!paused){
fill(144);
text(randomNum, x, y);}
}
void keyPressed() {
if(paused) {
paused = false;
}
else {
paused = true;
}
}
BTW can anyone help me to do one more step that's every number means a string So that make the output is a string instead of the number and the order of the string should be random
boolean paused = false;
float x, y;
void setup() {
size(800, 600);
background(255);
textFont(createFont("Georgia", 36));
textAlign(CENTER, CENTER);
smooth();
noStroke();
x = width / 3;
y = height / 3;
}
void draw() {
int randomNum = (int) random(24);
fill(204, 120);
rect(0, 0, width, height);
if (!paused){
fill(144);
text(randomNum, x, y);}
}
void keyPressed() {
if(paused) {
paused = false;
}
else {
paused = true;
}
}
BTW can anyone help me to do one more step that's every number means a string So that make the output is a string instead of the number and the order of the string should be random
1