As you all probably know, the enemies, or "ghosts" as they're called, don't stop moving, unless they are in the cage. I was wondering how i can make a program make them move continually while still getting the input direction to move Pacman through getch();. I would like to make them move them according to the difficulty the user sets. They way I want to count how long it takes them to move, or how long they have to wait inside the cage through <time.h>. Is there a way that it can continually run in the background, and then when the instance is met, execute a specific region of code?
If you can help me out any way it will be greatly appreciated.
No i do not know them, wasn't planning on making this program too complicated, just ordinary char array for the board and simple getch statements for direction.
There may be a function kbhit() that returns true if a keypress is available. If not, the way I'd do it is to set stdin to be non-blocking and do a read() of the file descriptor. (See fcntl and read functions).