how to start a timer on command?
              in 
             Programming Questions 
              •  
              11 months ago    
            
 
           
             hi guys,
            
             
            
            
             
            
            
             
            
            
             
            
             
            
 
            
           
             i got one small question. i want a timer to start and count in my program after a start it. i got an opening screen and if i press enter it goes to the main screen and i want the timer to start then instead of the beginning of the program. i made an small example of what is in my code. maybe you guys can help me.
            
            
             here is my code:
            
            - int begintime = 5;
 - int window = 0;
 - void setup() {
 - size(400, 400);
 - background(0);
 - }
 - void draw() {
 - if (window == 0) {
 - background(#FF0000);
 - }
 - if(window == 1) {
 - background(#FFFFFF);
 - int sec = frameCount/60;
 - int timer = begintime - sec;
 - if (timer <= 0) {
 - window = 2;
 - }
 - }
 - if(window == 2){
 - background(0);
 - }
 - }
 - void keyPressed() {
 - if (keyCode == ENTER) {
 - window =1;
 - }
 - }
 
             Thanks in advance
            
 
            
              
              1  
            
 
            