Hello there... can anyone find out what's wrong with the following code?
The problem with it is that it just doesn't print the 0 when the countdown finishes.
I used the wait method because with the delay method only, the program wasn't displaying some numbers (the weird thing is that it received the correct numbers, but jumped some of then ???? - when it jumps a number, it keeps in the next number more time)
Guess someone can find the problem.
Here is the code:
Code:PFont fontA;
int count = 10;
void setup(){
size(1024, 768);
background(random(255),random(255), random(255));
fill(random(255),random(255), random(255));
fontA = createFont("Palatino Linotype Negreta cursiva", 60);
textFont(fontA);
}
void draw() {
countdown(count--);
}
void countdown (int count) {
textAlign(CENTER, CENTER);
background(random(255),random(255), random(255));
fill(random(255),random(255), random(255));
text(Integer.toString(count),width/2, height/2);
wait(1000);
if (count == 0){
background(random(255),random(255), random(255));
text("Turn it on",width/2, height/2);
wait(1000);
}
}
void wait (int time) {
noLoop();
delay(time);
loop();
}