Okay, you need to read through your code, and follow it along logically...
3 // return _kbhit();
5 if (al_peek_next_event(
7 if (
kbdQueue); //remove all events but the keys
10 return 0;
12 if (
15 return 1;
18 return 0;
If a person presses a key, what line will this code return at?
If a person releases a key, what line will this code return at?
You are checking for a key down event, then clearing the queue and exiting with a return 0. You are also checking for a key up event in the same code. So no matter what happens, no matter what key is pressed, it will ALWAYS return 0 with nothing.
WHat you want to do, is to check if a key is pressed, or released, up to you (you can respond as soon as it is pressed, or wait for the person to release it). Anyhow, once it is pressed, you do not return right away, you then need to check which key was pressed INSIDE that same code, and respond to it accordingly... like this... in pseudo code.
Was a key pressed?
Get key that was pressed and respond to it.
else no key pressed, check for other events
You're checking if a key was pressed and then returning without doing anything at all. Check the example I showed you. It is in C, I clipped it straight out of my Deluxe Pacman 2 code, unedited, so it works. You will notice when I check to see if a key is released, if one was, than I immediately extract the key that was pressed and respond inside that loop.