So I am designing a game, and it will have the standard puzzle things that console games usually do.
My first problem came up when I made the structure containing the string that becomes the graphics on-screen (i.e. "||| |||
||| |||" for a door).
I wrote this:
Well, I'm working on a console game (as you know), let me give you some tips:
1.- Define correctly the libraries you're going to use. Allegro or Curses are (very) good options when wanting cross-platform console games, windows.h and conio.h are the best options when only using Windows if you don't want external libraries. Search ways to change the window title or instant pausing/key scanning, things like that.
2.- Use medium-sized ASCII images for EVERYTHING, makes the game much nicer and gives a better playing environment for text/puzzle games. Do not exceed 40-50 characters width or 10 lines high (The heigth can be greater on minigames). Remember to make cool main menus, and maybe add text color in some situations.
3.- Work on the 2 basic and essential global functions if your libraries don't satisfy you enough: Pausing and screen clearing. Personalize them with parameters, like using beeps (or sound) or not in what situations, or show or not "Press any key" or something like that when pausing (remember bool variables). The other 2 important (but optional) functions/qualities are sound (usually beeps) and text color (Don't abuse it very much, as it can get hard to understand and make the code like if for example you want a completely colored ASCII image).
4.- Using the arroy keys or the backspace and enter keys are very good ideas to select an option, or a slot in some puzzle, but remember, every single time you press a key, your functions and/or classes need to know what key you pressed and how to handle it, and a pointer for you to know what option/slot/whatever is selected is needed too, along with an obvious screen refreshing (clearing) each time.
For most Windows computers, (using an instant pausing/key scanning) the numbers for the most used keys in this situations are 72 for up arrow key, 80 for down arrow key, 77 for right arrow key, 75 for left arrow key, 13 (or 10) for enter key and 8 for backspace.
5.- Always be open for new ideas, and keep trying to accomplish what you want. You want a Tic-Tac-Toe with computer as the opponent? You want a combination lock working with the arrow keys? You want a labyrinth with "bird view"? You can always have help from the internet, your teacher, and your own mind.
PD: I recommend you to check the code of my game Skeptor (you already know it) for things like option selection or the paths/places minigame. It could help you with an idea of what I mean with the 5 points I mentioned before. Hope I helped you.
1.- ASCII images coded with C++ need strange codes, IDs or whatever for characters over ASCII symbol 120. Also, when wanting to show " , you need \" , and fora single backslash you need two (\\).
2.- There are some things that will always help you in console C++ games, arrays (singledimensional and multidimensional), rand() (with srand(time(0))), loops and classes. Also, as always, avoid global variables, system() and gotos.