Keyboard Input Problem??
I write some code to detect the input for my "soldier". I use directional key for move and space for fire. When I try to push two directional keys(e.g. "UP" & "LEFT") at same time to perform a 45 degree move, I found the fire key just has no response. And this is different on different computers. Some computers, I could only success to fire when I push "UP" & "RIGHT", and some computer only success when "LEFT" & "DOWN" is pushed. And there is no any problem if I use NumPad for direction input. There is the code I used(I use DirectInput to get input):
{
if (key[DIK_SPACE])
//do fire here;
if ((key[DIK_UP) && key[DIK_RIGHT]) // key[DIK_NUMPAD9])
//do up-right move
else if ...... //similar code as above
}
Ben
Use separate if statements to test for each keypress.
if() //Left
{}
if() //Right
{}
Faff_Master...
if() //Left
{}
if() //Right
{}
Faff_Master...
Faff...URL: http://home.compsoc.com/~dflynn/index.html
I don''t think you can do anything about it, some keys dont work when others are pressed, has to to with the internal workings of keyboards, try it with any game, you will have the same problem. For example in nba live I cant use turbo and run left and shoot, so I just run out of bounds
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement