Too much fix

Hello, I am using keyboard press function and when i press my button (down arrow one) that presses it too fast i know i can use delay, but i want it to work in dino no internet game, how can i fix it?

#include "Keyboard.h"
const int jumpButton = 8;
const int downButton = 12;
char ctrlKey = KEY_DOWN_ARROW;
void setup() {
  // put your setup code here, to run once:
  pinMode(jumpButton, INPUT);
  pinMode(downButton, INPUT);
  Keyboard.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
  if (digitalRead(jumpButton) == HIGH) {
    Keyboard.write(' ');
    delay(50);     
  }
    if (digitalRead(downButton) == HIGH) {
    Keyboard.write(KEY_DOWN_ARROW); // problem goes here
    delay(5);
  }
    }

Maybe use the state change detection method to see when the key becomes pressed as opposed to is pressed.