Friday, July 31, 2009

Am doing a Game program in C++ and i want 2 know how to make the program end at a gameover?

Probably the easiest way is to use the exit() function.





exit(0); will terminate your program and return control to the operating system.





Usually it's a good idea to display a gameover screen and wait for the user to press something before quitting.

Am doing a Game program in C++ and i want 2 know how to make the program end at a gameover?
You would need to create a game over function and call it whenever the player loses. It's best not to make the program simply quit but instead display a "game over" screen until a button is pressed, at which point the game should return to the menu screen.
Reply:create a game over funcutuion thats called when certain conditions are met





its good practice to wait for a button to be pressed before quiting a game
Reply:If your game is a Windows application, then I believe


PostQuitMessage(0);


should work.


No comments:

Post a Comment