Sunday, August 2, 2009

I want to make a text based games in console mode using C++. Help please!!?

I'm using Visual Studio 2005 in console mode. I want to make a little crapy games that when i press the arrow keys a character moves around the screen. Is there a command like "std::cin%26gt;%26gt;veriable;" exept it doesn't stop the flow of execution. It just scans if a key has been pressed or not. Simmiler to INKEY$ when using qbasic. Also any other tips on how i can make this charcter move around would be helpful. thanx

I want to make a text based games in console mode using C++. Help please!!?
There's a way to read a key without having to press enter after typing it. In C++ it could be done with "char ch=getch();"


But you will have to include "conio.h".
Reply:Using GetAsyncKeyState(VK_***); in your main loop would work.





#include %26lt;windows.h%26gt; to use this function.





See msdn.com for the virtual key scan codes.


No comments:

Post a Comment