pickleplayer Posted December 9, 2015 Share Posted December 9, 2015 So you guys know how if you hold down a button on the keyboard for a second, at first it just types out one letter. "q" . But then if you hold it down a little longer, it suddenly starts typing a whole bunch at once; "qqqqqqqqqq" So, does anyone have any suggestions for methods to get around this so that it only registers one button push, no matter how long you hold it down for? AddKeyDownHandler hasn't been cutting it. Link to comment https://forums.kleientertainment.com/forums/topic/60477-better-key-listeners/ Share on other sites More sharing options...
almightyjanitor Posted December 9, 2015 Share Posted December 9, 2015 Maybe something like this, basically listen for both KeyUp and KeyDown, and have a variable (keyheld) that toggles: local keyheld = false On KeyDown:if not keyheld then *Do your stuff*keyheld = true On KeyUp:keyheld = false Link to comment https://forums.kleientertainment.com/forums/topic/60477-better-key-listeners/#findComment-695124 Share on other sites More sharing options...
pickleplayer Posted December 9, 2015 Author Share Posted December 9, 2015 O. Yea I guess I couldThanks Link to comment https://forums.kleientertainment.com/forums/topic/60477-better-key-listeners/#findComment-695244 Share on other sites More sharing options...
Blueberrys Posted December 9, 2015 Share Posted December 9, 2015 (edited) @pickleplayer Here's a tutorial. Same concept as what almightyjanitor suggested, just more thorough. It's originally for a game engine in Java, but you can use the same algorithms. Edited December 9, 2015 by Blueberrys Link to comment https://forums.kleientertainment.com/forums/topic/60477-better-key-listeners/#findComment-695297 Share on other sites More sharing options...
pickleplayer Posted December 10, 2015 Author Share Posted December 10, 2015 @pickleplayer Here's a tutorial. Same concept as what almightyjanitor suggested, just more thorough. It's originally for a game engine in Java, but you can use the same algorithms. oh cool thanks! Link to comment https://forums.kleientertainment.com/forums/topic/60477-better-key-listeners/#findComment-695581 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now