can switch overwrite a delay?

This is my code, where a switch is pressed to turn on motor and pressed again to change the direction of the pins. This code controls 4 motors.
case 1 function well. my problem starts in case 2.
In case 2, after all the steps are carried out until the last step which I want to carry on until the button is pressed which will then run the next case.
Is it possible to do that?

const int buttonPin = 4; // the number of the pushbutton pin
int number = 0;
int buttonState = 0;
int IN1 = 6;
int IN2 = 7;
int IN3 = 9;
int IN4 = 10;
// variable for reading the pushbutton status

void setup() {
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
Serial.begin(9600);
}

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:##
if (buttonState == HIGH) {
Serial.println("on");
++number;
Serial.println(number);
delay(400);
}
else {
switch(number){

case 0:
Serial.println("redlight");
delay(100);
break;

case 1:
Serial.println("green");
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
// Rotate the Motor B clockwise
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
break;

case 2:
Serial.println("yellow");
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
delay(1900);//in ms ie 1s = 1000ms

digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
delay(5000);//in ms ie 1s = 1000ms

digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
delay(1900);//in ms ie 1s = 1000ms

digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
delay(100);//in ms ie 1s = 1000ms

//PHASE 3 when device travels upwards to the midpoint of the pipe
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
delay(3000);//in ms ie 1s = 1000ms

//STOPS FOR 5S AS MENTION IN BREIF AT THE MIDDLE
digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
delay(5000);//in ms ie 1s = 1000ms
// when device travels from the middle of the pipe to the top of the pipe

digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);

break;

case 3:
Serial.println("pink");
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
delay(3800);//in ms ie 1s = 1000ms

digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
delay(3000);//in ms ie 1s = 1000ms

digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
delay(50000);
break;
}
}
}

Hello Powerboat, welcome to the forum.

Deviously hidden in plain sight at the top of every forum on here you will find 'How to use this forum, please read'. Please read it, especially item 7.

When you've done that please work thorough the examples available, especially 'blink without delay' and 'using millis for timing'. The answer to at least some of your problems lie there.

If you are still struggling after that please come back and ask for more help.

Short answer: no. When delay() is used, the Arduino can do nothing else at the same time, not even checking for button presses.

If there was a way around this problem, we would keep it top secret. We would never reveal how is done in forum posts, and never make those posts "sticky" so that they always appear at the top of the forum!

EDIT: Perry beat me to it, and without the sarcasm and cynicism. Perry has not been around on the forum as long as I have and had not been worn down by the endless stream of the same questions and mistakes from newbies... Why do all newbies think the "please read this first" and "how to do X" don't apply to them? I suppose it's because they are newbies.