button press not working

Hello! I am working on a simple game where you use buttons to control a character that looks like a man on an LCD screen. You try and move it to a ball, similar to Snake. I was making a difficulty selector at the beginning around " while(gameplay == false)" Im using a button to enter what difficulty you want. I set up the button just like I did with the other direction button that works, I cant tell if it works. It immediately jumps to the gameplay section. But the gameplay section only happens if the button is pressed. But I'm not pressing the button. Can anyone tell me why?

#include <LiquidCrystal.h>

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4);
LiquidCrystal lcd1(7, 8, 9, 10, 11, 13);
int x = 0;
int y = 0;
int up = 3;
int right = 2;
int down = 5;
int left = 4;
short bx;
short by;
int ms = 0;
int wm = 0;
int tl = 0;
int score = 0;
int goal = 0;
int gameplay = false;
int difficulty = 0;
int select = 12;
byte Man[] = {
  B00100,
  B01010,
  B00100,
  B01110,
  B10101,
  B00100,
  B01010,
  B10001
};
byte ball[] = {
  B00000,
  B00000,
  B00000,
  B01110,
  B01110,
  B00000,
  B00000,
  B00000
};

void setup() {
  Serial.begin(9600);
pinMode(up, INPUT_PULLUP);
pinMode(left, INPUT_PULLUP);
pinMode(down, INPUT_PULLUP);
pinMode(right, INPUT_PULLUP);
pinMode(select, INPUT_PULLUP);

lcd1.begin(16,2);
  lcd.init();
lcd.backlight();
lcd.createChar(1, Man);
lcd.createChar(2, ball);
  lcd.setCursor(x,y);
lcd.write(1);
randomSeed(analogRead(0));
bx = random(0, 20);
by = random(0, 4);

}
void loop() {
  while (gameplay == false){
  lcd.setCursor(0,0);
  lcd.print("Choose Difficulty:");
  lcd.setCursor(0,2);
  lcd.print("<                  >");
  if (difficulty == 0 or difficulty == 2){
   lcd.setCursor(8,2);
   if(difficulty == 0){
    lcd.print("Easy");
   }

   if(difficulty == 2){
    lcd.print("Hard");
   }
  }
    if (difficulty == 1 or difficulty == 3){
   lcd.setCursor(7,2);
   if(difficulty == 1){
    lcd.print("Medium");
   }

   if(difficulty == 3){
    lcd.print("Expert");
   }
  }
  if(digitalRead(left) == HIGH){
    if(difficulty != 0){
      difficulty--;
    }
    else{
      difficulty = 3;
    }
  }
    if(digitalRead(right) == HIGH){
    if(difficulty != 3){
      difficulty++;
    }
    else{
      difficulty = 0;
    }
    }
    if (digitalRead(select) == HIGH){
      if(difficulty == 0){
        tl = 29;
        goal = 10;
      }
      if(difficulty == 1){
        tl = 59;
        goal = 30;
      }
      if(difficulty == 2){
        tl = 89;
        goal = 45;
      }
      if(difficulty == 3){
        tl = 119;
        goal = 75;
      }
      gameplay = true;
    }
  
  delay(100);
  }
lcd.clear();

  lcd.setCursor(x,y);
lcd.write(1);
lcd.setCursor( bx, by);
lcd.write(2);
if(digitalRead(down) == HIGH and y != 4){
y++;

}

if(digitalRead(up) == HIGH and y > 0){
y--;



}

if(digitalRead(left) == HIGH and x != -1){
x--;



}

if(digitalRead(right) == HIGH and x < 19){
x++;


}
if(x == bx and y == by){
 tone(6, 1975.53, 100);}
delay(100);
if(x == bx and y == by){
 tone(6, 2637.02, 100);
 score++;
 bx = random(0, 20);
by = random(0, 4);
}
ms++;
if(ms == 10){
  ms = 0;
  tl--;
}

Serial.println( x );
Serial.println( y );
lcd1.setCursor(0,0);
lcd1.print("Score:" );
lcd1.print(score);
lcd1.print("/");
lcd1.print(goal);
lcd1.setCursor(0,1);
lcd1.print("Time:");
lcd1.print(tl);
lcd1.print(".");
lcd1.print(ms);
while(goal == score or tl == 0 and ms == 0){
  if(score == goal){
  if(wm == 0){
    wm++;
    lcd.clear();
    lcd1.clear();
  }
    lcd.setCursor(0,0);
    lcd.print("you win");
    lcd1.setCursor(0,0);
    lcd1.print("you win");
    
  }
  else{
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("YOU LOSE ");
     lcd1.setCursor(0,0);
    lcd1.print("HAHA");
  }
}
}

I think the problem is occurring around "if (digitalRead(select) == HIGH)", but I can't figure out why. Below is a tinkercad diagram (sorry if it sucks). The LCD screen that isn't connected is controlled by A4 and A5. Thank you!

I tried looking if it registered on the press of one of the working buttons, and it doesn't. So its not a problem with the hardware, but the code itself.

You use INPUT_PULLUP; that means that a button that is not pressed will read as HIGH and a button that is pressed will read as LOW.

So all your digitalReads must be compared against LOW, not against HIGH.

Note:
With INPUT_PULLUP, your buttons must be wired between pin and GND, else they will never work. Hope you did that.

Im using a negative charge on the button presses so I use HIGH to test them

Okay, So I got it to work. I swear I had tried this before I posted, but I guess i didn't. I just changed the checking of the select button to LOW. But, All the other buttons, which are set up the same way test on HIGH. I don't need any more help with the project, but I would like to know why this is. Thanks.

Gosh I HATE Fritzing diagrams. It does not show clearly whether your switches are connected high or low.
Simply, if you want to read a button state you can tie the button to a ground line. Then if you set the terminal as INPUT_PULLUP it will be high when the button is normally open, and low when it is closed.
This is the best way because a button connecting to 0V is a very definite LOW.

When you release the button the input will reead high - thats why you are getting readings when testing for HIGH.

Okay, thanks for the explanation. Also, what should I use instead of fritzing diagrams because I don't like them either.

Luke21206:
what should I use instead of fritzing diagrams because I don't like them either.

Nothing wrong with pen or pencil on paper tbh, long as it photographs clearly, and your hand-writing's not "too bad".