Hello Simon, and welcome to the forums.
Terranova3y2 wrote:The game itself is actually terrible, I wouldn't force it on anyone but I decided to show the code here just to show my progress with C++
I wouldn't call it terrible, but you're entitled to your own opinion.
It's actually kind of interesting (I'm a sucker for nearly all text games).
Terranova3y2 wrote:I plan to add more things to the game as I learn them. (Health system, being able to restart after making a mistake, better story, multiple paths) but so far this is where I am.
Sounds like a very educational adventure into game development. Good luck.
Terranova3y2 wrote:I'm hoping that I'm structuring my programs well (please tell me if I'm not) and if you see anywhere I could improve it would be awesome.
Come to think of it, I've never actually made a text-based game. When I was starting, I jumped right into the thick of 2d games
and crashed into the ground then quit for a few months... So I can't really offer any specific advice about the structure(I dislike all the if statements; just can't think of a replacement right now). I'll probably play around with making something like this tonight to see if I can come up with some good advice.
The only thing I have in terms of code improvement are a few linux-compatibility whines.
1. You should probably explicitly
#include <cstdlib> for
system("pause").
2. That said,
system("pause") only works on ms and dos (and ms-dos?), and some people have extreme prejudices against it anyway: (
Things to Avoid in C/C++ -- system("pause"), Part 4 <-- has other things to avoid in c/c++ as well)
You may want to replace all the system pauses with (
note: I'm NOT an expert on anything, so this could be horrible code; in which case, I appoligze for my incompetence.):
Code: Select all
cout << "Press ENTER to continue..." << endl;
cin.ignore();
cin.get();
It would/should be easy to replace all instances using the replace all function of your IDE (I can't think of one that doesn't have it) should you choose to.
Well, I'm out. But before I go, I have a question. What publisher?? I must know.