Hello guys! I have a question for you and I'm sorry if I'm wasting your time.
I made a game in C++(I'm in high school so I don't know a lot of things).
My problem is that when I try to move my character in right it works if I press the key one time , but if I hold it , the character have a little bit of delay.
How can I remove that delay?
A simple solution is to set a bool to true when the key is pressed, and to set it back to false once the key is released.
In a seperate function/place you check this bool every frame, and if it is true, you apply whatever you want to happen when the key is pressed.
Right. kbhit() detects key presses. I thought for a moment you'd written kbhit() yourself. But it's in conio.h of course.
The problem is the repeat delay in the OS itself. And it doesn't look like conio.h has a function to tell you a key has been released. (key release is not the same as the key not being pressed)
You could try using a library that lets you deal with key events. Or directly use the OS functions for this.