Input: No response to pressing space key with left and up presesd
by Dmitry Yanushkevich · in Torque Game Builder · 03/29/2011 (8:44 am) · 4 replies
I'm a bit stuck here (with TGB 1.7.5, PC x86), with the following code failing to work:
The keys are cursor left/right for movement, cursor up for jump, space for fire. The issue itself is as described in subject: when I press both up and left and then hit space, actionFireBall() is not getting called. Pressing right instead of left works fine. Replacing the fire binding with, say, 's' key instead of space works fine.
Any ideas?.. Help will be greatly appreciated since I have no luxury of digging inside the C++ code at the moment as I did for some of the older issues.
function PlayerInputBehavior::onBehaviorAdd(%this)
{
if( isObject(moveMap) )
{
moveMap.bindObj(getWord(%this.leftKey, 0), getWord(%this.leftKey, 1), "actionMoveLeft", %this);
moveMap.bindObj(getWord(%this.rightKey, 0), getWord(%this.rightKey, 1), "actionMoveRight", %this);
moveMap.bindObj(getWord(%this.jumpKey, 0), getWord(%this.jumpKey, 1), "actionJump", %this);
moveMap.bindObj(getWord(%this.fireBallKey, 0), getWord(%this.fireBallKey, 1), "actionFireBall", %this);
}
}The keys are cursor left/right for movement, cursor up for jump, space for fire. The issue itself is as described in subject: when I press both up and left and then hit space, actionFireBall() is not getting called. Pressing right instead of left works fine. Replacing the fire binding with, say, 's' key instead of space works fine.
Any ideas?.. Help will be greatly appreciated since I have no luxury of digging inside the C++ code at the moment as I did for some of the older issues.
About the author
Worked here and there, did both game and business development. Finally decided to start own business, and here we are -- a cutie Cat Paw Studio has been born! :D
#2
Solution - define few control sets - arrow keys + WASD + numeric keyboard arrows for example.
03/30/2011 (3:57 am)
Yeah, it's a keyboard problem. Mine also does annoying blips when I press "wrong" combination. Basically can't play games that use arrow keys only.Solution - define few control sets - arrow keys + WASD + numeric keyboard arrows for example.
#3
Would you have the same issue polling the keyboard? Set up a move map where key presses set flags and schedule a loop to poll the keyboard and identify all keys currently pressed. Or, is it a matter of the keyboard being so poorly wired some keypresses are not even passed to the OS?
04/04/2011 (4:47 pm)
How do you politely tell players their keyboard is crap? You know they're going to blame the developer.Would you have the same issue polling the keyboard? Set up a move map where key presses set flags and schedule a loop to poll the keyboard and identify all keys currently pressed. Or, is it a matter of the keyboard being so poorly wired some keypresses are not even passed to the OS?
#4
Do you remember how ZX Spectrum keyboard was wired? And the problems it had detecting simultaneous pressing of several keys? :-)
Surely, we can do a test on WinAPI or DirectInput level to see whether we really get those events or they are lost somewhere inbetween. What are we to do if the result will be "your kb is crap, dood" ?
By the way, anyone willing to actually code the tests?
04/05/2011 (10:38 am)
Nikos,Do you remember how ZX Spectrum keyboard was wired? And the problems it had detecting simultaneous pressing of several keys? :-)
Surely, we can do a test on WinAPI or DirectInput level to see whether we really get those events or they are lost somewhere inbetween. What are we to do if the result will be "your kb is crap, dood" ?
By the way, anyone willing to actually code the tests?
Torque Owner Chris Labombard
Premium Preferred
If I hit up + right + space it still does this. Same with up + space. and Right + space. Same with Left + Space.
if I hit up + left + space it does not.
My conclusion: up + left + space is a windows shortcut for something.
My fix: make a key binding for up + left + space (I believe you can bind 3 keys at a time) and do your needed functionality that way.
EDIT: According to this forum board.flashkit.com/board/showthread.php?t=789015 it is a common problem and is caused by cheap keyboards and is unavoidable.
EDIT2: Down + Right + Space doesn't work either.