Keydown(key) / Keyhit(key) limitations?

BlitzMax Forums/BlitzMax Programming/Keydown(key) / Keyhit(key) limitations?

AvestheFox(Posted 2011) [#1]
> when the user holds the 'down' key the player sprite crouches
> when the user holds the 'left' or 'right' button while holding the 'down' button the player sprite crawls in either direction
> when the player hits the 'shoot' button while crawling, nothing happens

I've toyed with the code for several hours now and I cant seem to find a solution. I'm just wondering if the program can only detect so many button presses at once or something


GfK(Posted 2011) [#2]
Yep, and its a hardware limitation. Can't remember if its keyboard or motherboard, but there's not much you can do other than offer a Redefine Keys option, as certain combinations are OK, while others are not.


AvestheFox(Posted 2011) [#3]
well that's just poo on a stick :P


Shortwind(Posted 2011) [#4]
GfK is correct. To be specific it's a limitation in the keyboard matrix in almost all modern PC keyboards. Basically, they use the simplest method for creating the keyboard matrix. There have been very few keyboards over the years that are designed to detect multiple keypresses. Even the standard shift key isn't handled the same depending on the brand. The logic of course is the fact that under normal operation, a person isn't normally going to be pushing three or four keys at that same time.

Your best solution is to make your character have a toggled crawl position. Sorry, but unless your using a controller, there isn't much you can do to fix this situation without tons of head bashing.


AvestheFox(Posted 2011) [#5]
@Shortwind

Oh, I wasn't disagreeing with GfK (If that's what it sounded like) I was just being a total grump about the situation. sorry if that came out all wrong.

but yeah, I'll just have to figure something else out.

thanks for the explanations :)