Using global variables may be better, as then you can make a Timer class, and I don’t believe each class has an individual frameCount(multiple timers running at the same time, but not all starting at the same time)
class Timer {
float w;
float TimerSize;
float TimerMaxValue;
color TimerColor;
float Timerx,Timery;
Timer(tempTimerSize,tempTimerColor,tempTimerx,tempTimery,tempTimerMaxValue) {
TimerSize=tempTimerSize;
TimerColor=tempTimerColor;
TimerMaxValue=tempTimerMaxValue;
Timerx=tempTimerx;
Timery=tempTimery;
w=0;}
void display() {
fill(TimerColor);
textSize(TimerSize);
text(w,Timerx,Timery);}
void update() {
w+=0.0152;
if(tempTimerMaxValue!=null) {
if(w>=TimerMaxValue) { //greater than or equal to because may be 0.01 over/below max value
w=0;}
}
}
}