Hello,
I am trying to make a FPS game with a second game engine project that I have been working on. However, I noticed that when I play the game, I can only press down one key at a time, whereas a normal game allows you to hold down multiple keys at the same time (like “Up" and “Left”). This one, on the other hand, only lets me press “Up”, and when I press “Left”, the character would stop moving forward, and only move to the side.
Here is my walking forward code:
…
#define UP 0x4800
…
int main(void)
{
…
unsigned ch_val; //this variable will return what key is pressed.
if (bioskey(1))
{
ch_val = getkey();
if (ch_val==ESC)
{
done = 1;
}
switch(ch_val)
{
case UP: if ((com_device == 'n') || (com_device == 'm'))com_tx(PORT, 'a');
if (com_device=='e')
{
data_packet[20] = 'a';//networking BS
send_pkt (interrupt_number,data_packet, 64); //networking BS
}
result = movePOV(player,PlayerAngle,16); //this just increases an X value
if (result == POV_OBJECT)
check_objects();
moves++; //more networking crap
break;
}
…
}
I don't usually have this issue with bioskey, but I am in kind of a hurry to finish this part of the project, so I might be missing something. This is also one of my first attempts at making my own framework (with a keyboard). Maybe the way I set up the "getkey()" might be giving me errors.
I did not implement the left code, as it is just a simple increment to a variable.
I am not sure what is happening, and I have tried changing it to “if”and “while” statements, which I knew would not work, but, hey, it is worth giving them a chance.
Thanks for helping me in advance!
-Ryan