Hi everyone, I have a question: does anyone know how to put some sort of timer to insert a game interface?
I’m creating a game where there is an interface that must be shown initially and then disappear … does anyone know how I could make an image have a timer and then disappear?
Thank you
1 Like
int timer;
void setup() {
size(333,333);
timer = millis();
}
void draw() {
background(0);
if (millis()-timer > 3300) {
text("GAME", 111, 111);
} else {
text("Start image", 111, 111);
}
}
1 Like
Hello,
Check out:
In the timing example #1 (above website) should have this at the end of setup:
timer = millis();
to set a “start” time.
int timer;
void setup()
{
println(timer, millis());
timer = millis();
println(timer);
}
println() is your friend!
Notice that draw() does not start until around 400 ms after setup():
https://processing.org/reference/frameRate_.html Note the default!
https://processing.org/reference/frameCount.html
https://processing.org/reference/modulo.html Just because its fun!
https://processing.org/reference/millis_.html
It’s good to know your options.
:)
1 Like