LCD screen message cycling

Hi everyone!

We’re working on a project that is a choose your own adventure game. We are using an LCD screen and 2 buttons.

A question will be displayed on the LCD screen and the user can choose “yes” or “no” depending on the button that they press. This should allow the user to progress to the next question.

We’re having trouble because our message only changes if we hold down the button. When the button is released, the message reverts back to the first question.

Any help is greatly appreciated

~Struggling students

Here is the code :

#include <LiquidCrystal.h>

int yes_button = 11;
int no_button = 10;

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
//int i = 0;
//int buttonState = 0;
//int lastButtonState = 0;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
//pinMode(8, INPUT_PULLUP);
pinMode(yes_button, INPUT);
pinMode(no_button, INPUT);
// initialize the digital pin as an output.
lcd.begin(16, 2);
lcd.clear();

}

static bool trash = true;

void my_words(String words) {
if (digitalRead(yes_button) == HIGH && (trash == true)) {
lcd.print(words);
Serial.println(words);
static bool trash = false;
}
}

// the loop routine runs over and over again forever:
void loop() {
/*my_words(“hello friend”);
delay(1000);
lcd.clear();
delay(1000);
my_words(“yo whats shakin bacon”);
delay(1000);
lcd.clear();
delay(1000);

//static bool trash = true;*/

lcd.print(“Is it metal?”);
delay(1000);
lcd.clear();
delay(1000);
if ((digitalRead(yes_button) == HIGH) and (digitalRead(no_button) == LOW)) {
// lcd.print(“Is there food in it?”);

// if ((digitalRead(yes_button) == HIGH) and (digitalRead(no_button) == LOW)) {
// lcd.print(“Dump the food in compost and recycle the metal.”);
//}
//else {
//lcd.print(“Recycle”);
//}
}
else if ((digitalRead(yes_button) == LOW) and (digitalRead(no_button) == HIGH)) {
lcd.clear();
lcd.print(“Made of glass?”);
delay(1000);
lcd.clear();
delay(1000);

}

}