November 7th, 2008, 11:46 AM
Join Date: Oct 2008
Time spent in forums: 2 Days 3 h 13 m 21 sec
Reputation Power: 10
yeah and once you are using getch(), you can make it completely real-time for games by doing this simple improvement :
instead of just
you write something along the lines of :-
if( kbhit() ) // kbhit() is also from <conio.h>, by the way
key = getch();
key = 0;
you see, getch() will pause the program waiting for a key.
kbhit() returns true if a key is waiting to be read, otherwise returning false.
so the above this method will let your program run animated, and will only try and read a key when you have already hit one.
so, you could make an enemy to chase the player now if you wanted.
Although, with console it can be hard to see the animation clearly