Game Development Community

KeyBindings?

by Faital Ryuu · in Torque Game Builder · 03/09/2010 (12:18 pm) · 6 replies

I checked the Developer's Network but I don't know where to look for a list of key bindings. I want to try using the Left Shift key for a special kind of control. Until I know what it is, I can't try the key.

About the author

Recent Threads


#1
03/09/2010 (12:39 pm)
I think the left shift key on a standard PC keyboard should be referenced via; Microsoft.Xna.Framework.Input.Keys.LeftShift.

Depending on what you're doing using the input manager setup you would use something like:

inputMap.BindCommand(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.LeftShift, null, delagateName);
#2
03/09/2010 (12:44 pm)
In TorqueScript, here's an example of what I'm trying to do:

keys.bindCMD("keyboard", "<leftshift>", "slowdown();", "speedup();");

The <leftshift> part is the missing technical name for the key which is what I want to know.

I'm making my first shmup (AKA "top-down shooter") and I want to make a control that allows the player to slow down and speed up on the fly.

(Sorry for not specifying I was using TorqueScript)
#3
03/09/2010 (1:37 pm)
A list of keyboard general events can be found either in the online or offline documentation, under Reference->Input Interaction->Quick Reference->ActionMap Reference.

The left shift key is called simply shift. Right shift is rshift.
#4
03/09/2010 (2:36 pm)
Thanks, Mike.

Unfortunately, my shift control didn't work. The player's movement wouldn't stop if the left shift key was held down long enough. I noticed this also happened when a shift control wasn't set up. Do shift keys not get along with the engine? Or am I not setting up the left shift key correctly?
#5
03/10/2010 (12:31 am)
I was under the impression from previous work that a shift, control, or alt key couldn't be bound directly, but only as a modifier to a key ("alt a", "shift c", "ctrl x"). I know that I've had to write my own function which I could call to ask if shift was pressed, but it only worked in Windows (not Mac).
#6
03/10/2010 (10:39 am)
I had never previously bound the shift key before, but I tried it out just a minute ago. It works, you can bind it like a normal alphanumeric key.

The only issue is that the documentation is wrong. In the keyboard general events it lists "shift" and "rshift" but it is actually "lshift" and "rshift" (for left and right). So just add the l and it should work for you Faital.