..Flushkeys..
BlitzMax Forums/BlitzMax Programming/..Flushkeys..| 
 | ||
| ..im just wondering, is there a way to perform sort of FlushKeys() command but only for specific character ? | 
| 
 | ||
| Function flushOneKey(keycode%) KeyHit(keycode) EmitEvent (CreateEvent(EVENT_KEYUP,, keycode)) End Function | 
| 
 | ||
| Just calling the Key_hit function for the specific key was enough for me... This caused the key to be buffered and the jump executed at the next available opportunity (pseudo code).. 
if ( not OnGround )
  continuejump()
else 
  if ( keyhit( key_space ) )
     jump()
  end if 
end if 
Whereas, checking the key every update was what I needed to to.. 
local wantJump:Int = keyhit( key_space )
if ( not OnGround )
  continuejump()
else 
  if ( wantJump )
     jump()
  end if 
end if 
 | 
| 
 | ||
| I would say: Function FlushOneKey(keycode:Int) While KeyHit(keycode);Wend End Function | 
| 
 | ||
| While KeyHit(keycode);Wend KeyHit returns count of hitings from last call of KeyHit/FlushKey, and set counter to 0. So a While/Wend is not neccesary. |