I need no keystroke buffer.
Author |
Message |
Nitro
|
Posted: Fri Jan 17, 2003 3:30 pm Post subject: I need no keystroke buffer. |
|
|
in a game when I want to slow down my character by using a delay, the buffer records many keystrokes ahead of where my character is. For instance, if I press a key to activate an animation, but I hold down for a slightly longer period of time, the animation will repeat itself like 4 times. Definately unwanted. how do I fix this? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dan
|
Posted: Fri Jan 17, 2003 5:49 pm Post subject: (No subject) |
|
|
code: |
procedure flush
var ch : string ( 1 )
loop
exit when not hasch
getch ( ch ) % Discard this character
end loop
end flush
|
put this in your code close to top and put in flush when you need to clear out buffer. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
|
|