Change what a push button does with each press

Okay so attached below is the code I've got so far for my light logic puzzle game.
I've been able to set it up so that button 2 turns on/off led 1,2,4 regardless if the other other buttons have turned other leds on.
There is nothing wrong with the code; what I want to do is to add more to it to achieve my end goal.

The end goal of which is to have for example:
press button 2 once led 1,2,4 turn on
press button 2 again led 1,2,4 turn off
Press button 2 again led 2,5 turn on
press button 2 again led 2,5 turn off
press button 2 again led 1,2,4 turn on

so each on/off sequence changes which leds are affected.

If someone can either give a me a sample code for me to edit for my purposes or direct me to a forum post that has had a similar ask it would be much appreciated.

[code]
float pressLength_milliSeconds1 = 0;
float pressLength_milliSeconds2 = 0;
float pressLength_milliSeconds3 = 0;
float pressLength_milliSeconds4 = 0;

int optionOne_milliSeconds = 100;
int optionTwo_milliSeconds = 100;
int optionThree_milliSeconds = 100;
int optionFour_milliSeconds = 100;
int optionFive_milliSeconds = 100;

//The Pin your button is attached to
int buttonPin1 = 2;
int buttonPin2 = 3;
int buttonPin3 = 4;
int buttonPin4 = 5;

//Pin your LEDs are attached to
int ledPin_Option_1 = 13;
int ledPin_Option_2 = 12;
int ledPin_Option_3 = 11;
int ledPin_Option_4 = 10;
int ledPin_Option_5 = 9;

int piezo = 8;
int duration = 200;

int notes [] =
{392, 440, 493, 440, 493, 523, 493, 440, 493, 523, 587, 523, 493, 440, 493, 523, 587, 659};
// A , B, A, B, C, B, A, B, C, D, C, B, A, B, C, D, E

void setup() {

  pinMode(buttonPin1, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);
  pinMode(buttonPin3, INPUT_PULLUP);
  pinMode(buttonPin4, INPUT_PULLUP);

  //set the LEDs pins as outputs
  pinMode(ledPin_Option_1, OUTPUT);
  pinMode(ledPin_Option_2, OUTPUT);
  pinMode(ledPin_Option_3, OUTPUT);
  pinMode(ledPin_Option_4, OUTPUT);
  pinMode(ledPin_Option_5, OUTPUT);
  pinMode(piezo, OUTPUT);

} // close setup


void loop() {

  //Record *roughly* the tenths of seconds the button in being held down
  while (digitalRead(buttonPin1) == LOW ) {

    delay(100);  //if you want more resolution, lower this number
    pressLength_milliSeconds1 = pressLength_milliSeconds1 + 100;

    //display how long button is has been held
    Serial.print("ms = ");
    Serial.println(pressLength_milliSeconds1);
  }
  while (digitalRead(buttonPin2) == LOW) {
    delay(100);  //if you want more resolution, lower this number
    pressLength_milliSeconds2 = pressLength_milliSeconds2 + 100;

    //display how long button is has been held
    Serial.print("ms = ");
    Serial.println(pressLength_milliSeconds2);
  }
  while (digitalRead(buttonPin3) == LOW) {
    delay(100);  //if you want more resolution, lower this number
    pressLength_milliSeconds3 = pressLength_milliSeconds3 + 100;

    //display how long button is has been held
    Serial.print("ms = ");
    Serial.println(pressLength_milliSeconds3);
  }
  while (digitalRead(buttonPin4) == LOW) {
    delay(100);  //if you want more resolution, lower this number
    pressLength_milliSeconds4 = pressLength_milliSeconds4 + 100;

    //display how long button is has been held
    Serial.print("ms = ");
    Serial.println(pressLength_milliSeconds4);
  }
  //button 4
  if (pressLength_milliSeconds4 >= optionFive_milliSeconds) {
    digitalWrite(ledPin_Option_5, !digitalRead(ledPin_Option_5));
  }
  if (pressLength_milliSeconds4 >= optionThree_milliSeconds) {
    digitalWrite(ledPin_Option_3, !digitalRead(ledPin_Option_3));
  }
  //button 3
  if (pressLength_milliSeconds3 >= optionFive_milliSeconds) {
    digitalWrite(ledPin_Option_5, !digitalRead(ledPin_Option_5));
  }
  if (pressLength_milliSeconds3 >= optionFour_milliSeconds) {
    digitalWrite(ledPin_Option_4, !digitalRead(ledPin_Option_4));
  }
  if (pressLength_milliSeconds3 >= optionTwo_milliSeconds) {
    digitalWrite(ledPin_Option_2, !digitalRead(ledPin_Option_2));
  }
  //button 2
  if (pressLength_milliSeconds2 >= optionFour_milliSeconds) {
    digitalWrite(ledPin_Option_4, !digitalRead(ledPin_Option_4));
  }
  if (pressLength_milliSeconds2 >= optionTwo_milliSeconds) {
    digitalWrite(ledPin_Option_2, !digitalRead(ledPin_Option_2));
  }
  if (pressLength_milliSeconds2 >= optionOne_milliSeconds) {
    digitalWrite(ledPin_Option_1, !digitalRead(ledPin_Option_1));
  }


  //button 1
  if (pressLength_milliSeconds1 >= optionThree_milliSeconds) {
    digitalWrite(ledPin_Option_3, !digitalRead(ledPin_Option_3));
  }
  if (pressLength_milliSeconds1 >= optionOne_milliSeconds) {
    digitalWrite(ledPin_Option_1, !digitalRead(ledPin_Option_1));

  }//close if options

  {
    //every time through the loop, we need to reset the pressLength_Seconds counter
    pressLength_milliSeconds1 = 0;
    pressLength_milliSeconds2 = 0;
    pressLength_milliSeconds3 = 0;
    pressLength_milliSeconds4 = 0;

  }

  { if (digitalRead(ledPin_Option_1) == HIGH &&
        digitalRead(ledPin_Option_2) == HIGH &&
        digitalRead(ledPin_Option_3) == HIGH &&
        digitalRead(ledPin_Option_4) == HIGH &&
        digitalRead(ledPin_Option_5) == HIGH) {

      for (int i = 0; i < 13; i++)
      {
        tone(piezo, notes[i], duration);
        delay (duration);
      }
      for (int i = 11; i > 0; i--)
      {
        tone(piezo, notes[i], duration);
        delay (duration);
      }
    }
    else {
      digitalWrite (piezo, LOW);
    }
  }
}

[/code]

If someone can either give a me a sample code for me to edit for my purposes or direct me to a forum post that has had a similar ask it would be much appreciated.

The state change detection example does just what you want.