L298N 2 DC MOTORS

Hi,im using this code to make
motorA to turn ,
CW for 600ms and stop for 2sec and then
CCW for 600ms and stop for 4sec
when buttonPin3 is pressed
and
motorB to turn ,
CW for 600ms and stop for 2sec and then
CCW for 600ms and stop for 4sec
when buttonPin4 is pressed

my problem is that while one button is pressed ,if i push the other button ,the motor which is waiting doesnt work immediately but is waiting the other to finish his loop.

any help is wellcome ,thanks

const int  buttonPin1 = 12;
const int   buttonPin2 = 13;
const int  buttonPin3 = 11;
const int  buttonPin4 = 10;
int buttonState1 = LOW; 
int buttonState2 = LOW;
int buttonState3 = LOW; 
int buttonState4 = LOW;
#define ENA 5  //enable A on pin 5 (needs to be a pwm pin3,5,6,9,10,11)
#define ENB 9  //enable B on pin 9 (needs to be a pwm pin)
#define IN1 2  //IN1 on pin 2 conrtols one side of bridge A
#define IN2 4  //IN2 on pin 4 controls other side of A
#define IN3 7  //IN3 on pin 1 conrtols one side of bridge B
#define IN4 8  //IN4 on pin 8 controls other side of B


void setup()
{
  Serial.begin(9600);
  //set all of the outputs
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(12, INPUT);
  pinMode(13, INPUT);
  pinMode(11, INPUT);
  pinMode(10, INPUT);
}

void loop()
{
  buttonState1 = digitalRead(12);
  buttonState2 = digitalRead(13);
  buttonState3 = digitalRead(11);
  buttonState4 = digitalRead(10);
  

 
   
   if (buttonState3 == HIGH) {
     //RUN MOTOR A

  motorA(1, 80);
for (int x=0; x < 600; x++) {     
      delay(1);
  }
  motorA(3, 0);
  
for (int x=0; x < 2000; x++) {     
      delay(1);}
   
  motorA(2, 80);
for (int x=0; x < 600; x++) {   
      delay(1);}
   
  motorA(3, 0);
for (int x=0; x < 4000; x++) {    
      delay(1);}
   }
else{ motorA(3, 0);}

 
  if (buttonState4 == HIGH) {
     //RUN MOTOR B

 
  motorB(2, 95);  
for (int y=0; y < 600; y++) {    
      delay(1);
  }

  motorB(3, 0);
  
for (int y=0; y < 2000; y++) {     
      delay(1);}
   
 
  motorB(1, 95);  
for (int y=0; y < 600; y++) {    
      delay(1);}
   
  
  motorB(3, 0);
for (int y=0; y < 4000; y++) {     
      delay(1);}
   }
else{ motorB(3, 0);}
  
}

//******************   Motor A control   *******************
void motorA(int mode, int percent)
{
  
  //change the percentage range of 0 -> 100 into the PWM
  //range of 0 -> 255 using the map function
  int duty = map(percent, 0, 100, 0, 255);
  
  switch(mode)
  {
    case 0:  //disable/coast
      digitalWrite(ENA, LOW);  //set enable low to disable A
      break;
      
    case 1:  //turn clockwise
      //setting IN1 high connects motor lead 1 to +voltage
      digitalWrite(IN1, HIGH);   
      
      //setting IN2 low connects motor lead 2 to ground
      digitalWrite(IN2, LOW);  
      
      //use pwm to control motor speed through enable pin
      analogWrite(ENA, duty);  
      
      break;
      
    case 2:  //turn counter-clockwise
      //setting IN1 low connects motor lead 1 to ground
      digitalWrite(IN1, LOW);   
      
      //setting IN2 high connects motor lead 2 to +voltage
      digitalWrite(IN2, HIGH);  
      
      //use pwm to control motor speed through enable pin
      analogWrite(ENA, duty);  
      
      break;
      
    case 3:  //brake motor
      //setting IN1 low connects motor lead 1 to ground
      digitalWrite(IN1, LOW);   
      
      //setting IN2 high connects motor lead 2 to ground
      digitalWrite(IN2, LOW);  
      
      //use pwm to control motor braking power 
      //through enable pin
      analogWrite(ENA, duty);  
      
      break;
  }
}



//******************   Motor B control   *******************
  void motorB(int mode, int percent)
{
  
  //change the percentage range of 0 -> 100 into the PWM
  //range of 0 -> 255 using the map function
  int duty = map(percent, 0, 100, 0, 255);
  
  switch(mode)
  {
    case 0:  //disable/coast
      digitalWrite(ENB, LOW);  //set enable low to disable B
      break;
      
    case 1:  //turn clockwise
      //setting IN3 high connects motor lead 1 to +voltage
      digitalWrite(IN3, HIGH);   
      
      //setting IN4 low connects motor lead 2 to ground
      digitalWrite(IN4, LOW);  
      
      //use pwm to control motor speed through enable pin
      analogWrite(ENB, duty);  
      
      break;
      
    case 2:  //turn counter-clockwise
      //setting IN3 low connects motor lead 1 to ground
      digitalWrite(IN3, LOW);   
      
      //setting IN4 high connects motor lead 2 to +voltage
      digitalWrite(IN4, HIGH);  
      
      //use pwm to control motor speed through enable pin
      analogWrite(ENB, duty);  
      
      break;
      
    case 3:  //brake motor
      //setting IN3 low connects motor lead 1 to ground
      digitalWrite(IN3, LOW);   
      
      //setting IN4 high connects motor lead 2 to ground
      digitalWrite(IN4, LOW);  
      
      //use pwm to control motor braking power 
      //through enable pin
      analogWrite(ENB, duty);  
      
      break;
  }
}

While your code is executing delay(), it isn't looking at switches. Get rid of all the delays. Have a look at the blink without delay example, without delay. Or Robin2's tutorial of how to do many things at once.

any idea how can i split my code to do this simple movement with one button to one motor and with the other button to the other motor independently and(or) the same time?