Rick Posted September 25, 2015 Share Posted September 25, 2015 Maybe this isn't a bug but it seems like a bug to me.If I have logic that doesn't let me hit the KeyHit(Key.F) line and I hit the 'f' key, and then I have logic that hits that KeyHit(Key.F) function in later frames, the action will happen even though I hit the 'f' key many frames ago. So this seems like hitting keys on the keyboard set some flag that it was hit but doesn't release that flag until KeyHit() is called. To me it seems like key hits should get released each frame. Does that make sense? I know KeyHit() says the following (below) but is there a case where this behavior is really wanted vs having it reset each frame? Returns true if the specified key is has been pressed since the last time it was checked, otherwise false is returned. I know I can use KeyDown() but then for toggle behavior I have to make a boolean flag to go along with it. Should KeyHit() be that toggle behavior for us? Quote Link to comment Share on other sites More sharing options...
Josh Posted September 25, 2015 Share Posted September 25, 2015 Window:FlushKeys() will set all key states to 0. Call this before you switch to a menu or something. 4 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Genebris Posted September 25, 2015 Share Posted September 25, 2015 Window:FlushKeys() will set all key states to 0. Call this before you switch to a menu or something. Seems like another very importand method that isn't documented. It really should be listed at least somehow. 2 Quote Link to comment Share on other sites More sharing options...
thehankinator Posted September 25, 2015 Share Posted September 25, 2015 Window:FlushKeys() will set all key states to 0. Call this before you switch to a menu or something. Ugggghhh I wish I knew this months ago. I've resorted to wrapping KeyHit() to handle the extra key hit behavior. Quote Link to comment Share on other sites More sharing options...
Josh Posted September 26, 2015 Share Posted September 26, 2015 Added docs for FLushMouse and FlushKeys(). 3 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.