How to turn off repeating keys in JavaScript html?

Question:
I am making a game where you use keydown to move, but when i hold a button on the keyboard it repeats and i want to disable that. If possible, how could i do that without making a cooldown and just disabling it?
Repl link:
https://replit.com/@AriWale/BestTealSpyware?v=1

(If Keydown===input){move in a direction;}

(line 429: Level 1)

This is not HTML; it’s JavaScript. HTML just sets up the structure of the website, but JS gives it features, and CSS gives it aesthetics. You are asking a question about JavaScript.

Yeah but java is different and i listed it as html, css, js.

What I meant was that the question title contained “in html” when this is a question for JavaScript (JS). HTML can’t make a game, but JavaScript within HTML can. I never said it was Java; I always used either “JavaScript” or “JS”.

There i changed it to script html

1 Like

Can you give us the line && file name of the code above?

yep! I just added it.

1 Like

Can you explain what walkable does?

It is the variable that tells you this: if the block you are trying to go to is the value of walkable or lower you can walk there

There isn’t any special “keydown once” event that you can choose. The “keydown” event will repeat forever until you released the key.

I think OP means keys as in keyboard keys, not mouse.

2 Likes

thanks for pointing out my mistake

1 Like