We are about to switch to a new forum software. Until then we have removed the registration on this forum.
how do i make a score that goes up by 1 every second? im making a pong gameyou have to keep the ball up
Since by default draw() is invoked about 60 times per second: https://processing.org/reference/draw_.html https://processing.org/reference/frameRate_.html
Just check whether frameCount is divisible by 60: https://processing.org/reference/frameCount.html https://processing.org/reference/modulo.html
If accuracy is a factor then you need to use one of the time methods, preferably millis(). using frameCount as a measure of time is prone to error.
Indeed millis() is the most accurate and more advisable to most cases. However, if the sketch happens to run slower than 60 FPS, millis()'s approach gonna increase the score more times than the amount of actual "action" transpired! >-)
Answers
Since by default draw() is invoked about 60 times per second:
https://processing.org/reference/draw_.html
https://processing.org/reference/frameRate_.html
Just check whether frameCount is divisible by 60:
https://processing.org/reference/frameCount.html
https://processing.org/reference/modulo.html
If accuracy is a factor then you need to use one of the time methods, preferably millis(). using frameCount as a measure of time is prone to error.
Indeed millis() is the most accurate and more advisable to most cases.
However, if the sketch happens to run slower than 60 FPS, millis()'s approach gonna increase the score more times than the amount of actual "action" transpired! >-)