Does anyone know what is wrong with this program?

int h,m;
void  setup(){
 size (800,600);
 frameRate(10);
}
void draw (){
//  if (framec==0){
    background (180);
    stroke (0);
    fill(255);
  rect (0,500,width,height);//chenar jos
  h=nf(hits);
  m=nf(misses);
  fill(0);
  h="HITS:"+h+"/MISSES:"+m;
  textAlign(CENTER); textSize(50);
  text (h,width/2,570);
 
  float x=20+random (width-20);
  float y=20+random (height-120);
 fill (random(255),random(255),random(255),50);
 noStroke(); /*int c1=int(random(255)); int c2=int(random (255)); int c3= int (random (255));*/// fill(c1,c2,c3); noStroke();
  ellipse (x,y,40,40);
 q=char( int (97+random(26)));
 textSize(40);
 textAlign(CENTER); fill(0);
 text (q,x,y+10);
  }
  else d= key;
if (fc==fl)
if (d==q) hits++; else misses++;
fc++;
if(fc>fl) fc=0

}
void keyPressed()
{
  d=key; fc=fl;
}
if(misses>3)
{
  fill(255,0,0);
  rect(0,0,width,height-100);
  fill(0);
  textAlign (CENTER);
  text("GAME OVER!", width/2,height/2);
  noLoop();
}

here is what the result should be:

Hi @add,

What happens if you run your code in PDE ?
Do you get any hints in the editor pane and/or console window ?
Have you tried to follow these hints?

I would recommend that you go through your code (line by line) and try to add comments what each line is doing or what it should doing and what possible went wrong.

Don’t hesitate to come back if you have concrete questions…

Cheers
— mnse

1 Like

Hello again @add :slightly_smiling_face:

Can you sum up in a sentence what your program is supposed to do?
How are we to evaluate it when we do not know what the end result is supposed to be?

Concrete help requires concrete question(s).
Your question is much too general.
:nerd_face:

1 Like