QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Jaze on May 19, 2021, 12:54:45 am

Title: Using INKEY$ and on screen movement
Post by: Jaze on May 19, 2021, 12:54:45 am
I'm using INKEY$ to read the left and right arrow keys. The trouble I'm having is when the arrow key is held down. When the arrow key is pressed, the paddle on the screen moves in the corresponding direction. When the arrow key is held down the paddle moves once, pauses for a moment and then moves continuously. Is there any way to get rid of that pause?
Title: Re: Using INKEY$ and on screen movement
Post by: NOVARSEG on May 19, 2021, 01:28:38 am
I think the delay is controlled by the OS. 
Title: Re: Using INKEY$ and on screen movement
Post by: 191Brian on May 19, 2021, 03:16:12 am
Hi the delay is the Os wait time before auto repeat starts best way to avoid it is to use _keydown instead.
Title: Re: Using INKEY$ and on screen movement
Post by: Pete on May 19, 2021, 10:24:09 am
In the old QBasic days, we used INP for that, which is still available in QB64. INP has some baggage of its own, as to how to implement it properly. The new key functions, like the example given in a previous text, would probably be your best bet. QB64 aslso offers _KEYCLEAR, if you need to clear the keyboard buffer.

INKEY$ is great for text programs, but was not made gaming.

Pete