   { -1, -1,   -1,   -1,   -1}
 };
 int game = GAME_START,
-    x, y, vector;
+    x = -1, y = -1, vector = 0, xPrev = -1, yPrev = -1, vectorPrev = 0;
+unsigned long currentMillis = 0, previousMillis = 0;
+boolean ballkick = false;
 
 void setup() {
   // put your setup code here, to run once:
   MsTimer2::set(2, timerInterupt); // задаем период прерывания по таймеру 2 мс
-  MsTimer2::start();              // разрешаем прерывание по таймеру  
+  MsTimer2::start();              // разрешаем прерывание по таймеру
+
+  currentMillis = millis();
+  previousMillis = currentMillis;
+
   randomSeed(analogRead(RANDOMSEED_PIN));
   pinMode(SPEAKER_PIN, OUTPUT);
 

  }
}

void start_game() {
  game = 999;
  lcd.init();
  button11.flagClick = 0;
  button21.flagClick = 0;
  for (int j = 1000; j > 0; j = j - 100 ) {
    for (int i = 2; i <= 13; i++) { //init rgb leds
      digitalWrite(i, HIGH);
    }
    delay(j);
    for (int i = 2; i <= 13; i++) { //init rgb leds
      //lcd.setCursor(12, 1); lcd.print(analogRead(b11));
      //lcd.setCursor(15, 1); lcd.print(analogRead(b21));
      digitalWrite(i, LOW);
    }
    delay(j);

    if (button11.flagClick == 1 && button21.flagClick == 1) {
      lcd.setCursor(0, 0); lcd.print("Both plrs false start!");
      return;
    }
    else if (button21.flagClick == 1) {
      lcd.setCursor(0, 0); lcd.print("Red plr false start! Green plr wins!");
      game = GAME_PERFORMED;
      x = 5; y = 2; vector = 1;
      return;
    }
    else if (button11.flagClick == 1) {
      lcd.setCursor(0, 0); lcd.print("Green plr false start! Red plr wins!");
      game = GAME_PERFORMED;
      x = 6; y = 2; vector = -1;
      return;
    }
  }
  tone(SPEAKER_PIN, 3000, 250);
  while (1) {
    if (button11.flagClick == 1) {
      lcd.setCursor(0, 0); lcd.print("Green plr wins!");
      game = GAME_PERFORMED;
      x = 5; y = 2; vector = 1;
      return;
    }
    else if (button21.flagClick == 1) {
      lcd.setCursor(0, 0); lcd.print("Red plr wins!");
      game = GAME_PERFORMED;
      x = 6; y = 2; vector = -1;
      return;
    }
  }
}

void in_game() {
  button11.flagClick = 0;
  button12.flagClick = 0;
  button13.flagClick = 0;

// при нажатой кнопке flagPress= true
// при отжатой кнопке flagPress= false
// при нажатии на кнопку flagClick= true
boolean Button::scanState() {
  boolean _stateChanged = false;
  if ( flagPress != digitalRead(_pin) ) {
    //  состояние кнопки осталось прежним
    _buttonCount = 0; // сброс счетчика подтверждений
