Computer Science Canada

I need no keystroke buffer.

Author:  Nitro [ 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?

Author:  Dan [ Fri Jan 17, 2003 5:49 pm ]
Post 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.


: