Timer help part 2 because I'm processingly challenged

i am trying to make a hot and cold game and have the circles that say if I’m cold or not appear when i click and i have all of that completed, but i want them to disappear 2 seconds or 120 frames after i have clicked every time and have a counter for how many times i have clicked. i was wondering if i could get any help as i am completely stumped and cannot figure it out. the circles will disappear from around my mouse in 1 frame by the looks of it but I want them to last for 120 frames. I also apologize in advance for how horrible my code is and how badly formatted it is as I am very new to coding

final int ballDiam = 30; //diam of the randomly occuring invisible ball
float posX; //decloration of the X position of the random ball 
float posY; //decloration of the Y position of the random ball
final int coldDetector = 400; //diam of the cold circle
final int warmDetector = 250; //diam of the warm circle
final int hotDetector = 100; //diam of the hot circle
final int hotColor = color(255,0,0); //color of the hot circle
final int warmColor = color(255,100,0); //color of the warm circle
final int coldColor = color(0,0,255); //color of the cold circle 

float textWidth = width/2;
float textAscent = 10;
float textDescent =2 ;
boolean mouseClicked = false;
int timer;
int counter;


//setup 
void setup()
{
 size(500,500); //size of the program
 posX = random(width); //properties of the random X location
  posY = random(height); //properties of the random Y location
  timer = millis();
  
}
//drawn fumctions
void draw()
{
  
  background(200); //background color
 //add stroke (stroke(200); when progrm is finished
  fill(200); 
  {
    stroke(0);
  ellipse(posX,posY,ballDiam,ballDiam); //random invisible ball meant to be found
  //hot circle
  }
}
  
  
  
  void mouseClicked() {
  
  if  (dist(mouseX,mouseY,posX,posY)>300 )
  {
  String F = "You're freezing!";
    textAlign(255,255);
    textSize(15);
    fill(0,30,255);
    text(F,255,255);
  }
  else if (dist(mouseX,mouseY,posX,posY)>200)
  {
  noFill();
  stroke(coldColor);
  ellipse(mouseX,mouseY,coldDetector,coldDetector);
  }
    else if (dist(mouseX,mouseY,posX,posY)>125)
    {
      noFill();
      stroke(warmColor);
      

stroke(warmColor);
      ellipse(mouseX,mouseY,warmDetector,warmDetector);
  }
    else if (dist(mouseX,mouseY,posX,posY)>50) //initial if statement for the hot circle around the mouse 
  {
  noFill();
    stroke(hotColor);
    ellipse(mouseX,mouseY,hotDetector,hotDetector);
    
  }     
  }
1 Like

12 posts were merged into an existing topic: Creating a frame timer