If you didn't understand the question, try the following: go to the input field in the comments and then hold a key on your keyboard. You will see that it will do something like the following: "x - (small stutter) - xxxxxxxxxxxxxxxxxxxxxxx...". I'm pretty sure that small stutter is because it's going from "single character" mode to "hold down the character" mode, but is there a way to bypass this small stutter? I'm creating a 2d car, and the stutter causes the car to move a bit, stop, and then continue driving. Here is the part of my code the stutter is affecting:
document.body.addEventListener("keydown", function () {
drive = true;
if (drive) {
carLeft += 50;
speed += 5;
car.style.left = carLeft + "px";
}
if (carLeft >= 1900) {
alert("You left the playing area!");
break;
}
});
I'm sorry if this is a poor question/poorly formatted question, I don't have a lot of time to ask this. Thanks in advance!