I want to make a simple game using the console and X,Y coordinates. I haven't started on this project because if I can't figure out how to make the computer recognize a key (Like the up arrow.) at any time to make the character move on the screen then the game won't work.
I'm asking: how do I make a key be recognized any time in a loop and have it do something?
char temp;
temp=getch(); //temp = any key you press!
if(GetAsyncKeyState(VK_DOWN) //if the key pressed was the down arrow key, execute...
{...........}
A free game engine will have a different way of getting input than anything you'll do in the console... so if that's your goal... then learning how to do this in the console is a complete waste of time.
OK. Any ways I want to know how to do it. Can someone just answer me and stop telling me to not do it this way.
I know there is a way to do it because I have seen other programs made on the console that are games.
Well then GetAsyncKeyState is what you want (if you're on Windows).
GetAsyncKeyState alone will let you check the realtime state of any key, and it is non-blocking, meanting it will return immediately (not causing your program to stop).