| BushMuffin (23) | |
|
Hey guys so I am making Hangman, I am almost done. I have a menu and the game itself as well as instructions. But the menu and the game are both separate files. How can I make it so the menu calls on the game when the user makes an input? Would it be better for the menu to call on the hangman.cpp file or integrate them all together or make the game a function?1. Menu calls on other files 2. All in one 3. Or put the game and instructions into separate functions? Which would be easier? | |
|
Last edited on
|
|
| SamuelAdams (192) | |||||
|
Without posting your code and what your using to compile, I don't think your going to get a complete answer. Normally you would create a project. include both files. Then when the user chooses a menu option, you would call the game function. You can do it in one file but there is no need to do so. Once the game is ended, it will return control to the main/menu part of the code. something like this; // File one
// File two
| |||||
|
Last edited on
|
|||||
| BushMuffin (23) | |
|
Deleted | |
|
Last edited on
|
|
| programmeraie125 (86) | |
|
I would personally recommend that you build a simple state manager and swap between states have an instructions state,menu state and a play game state http://gamedevgeek.com/tutorials/managing-game-states-in-c/ this link will give you an overview on states. Best thing about states is you can always add more if you feel like extending your game =D | |
|
|
|
| BushMuffin (23) | |
|
Thank you I will read up :) EDIT: I notice that this is for C. I assume that this also applies to c++? | |
|
Last edited on
|
|
| programmeraie125 (86) | |
| yeah works just as well for c++ | |
|
|
|