Alright!!
Here it is:
I want to make a text-based game, similar to say, "Hitchhiker's Guide to the Galaxy", if you have played that. What I can't figure out is how to set up the variables/whatever, so that it recognize "where" you are in the game. E.G. If you go north from the original position, how will it recognize you went north when you give your next direction. I guess I did figure out how to do this, but my way would take a long time, and I don't think it is the best way. Right now, I just want to be able to move around in different rooms, although later I want to implement picking up items and using them, and if possible, do combat somehow. Here is what I have so far:
#include <apstring.cpp>
#include <apstring.h>
#include <iomanip.h>
#include <conio.h>
int main()
{
apstring direction;
cout<<"You are in a small room with two exits."<<endl;
cout<<"Which direction would you like to go?"<<endl;
cout<<endl;
cin>>direction;
if (direction == "N")
{
cout<<"Here this is"<<endl;
}
else if (direction == "S")
{
cout<<"You fall into a pit and die!"<<endl;
}
//Module for next move if first direction was North.
{
if (direction == "N")
{
cin>>direction;
if (direction == "S")
{
cout<<"You are in a small room with two exits."<<endl;
}
}
}
//Module for if first direction was South.
{
if (direction == "S")
{
cin>>direction;
if (direction == "N")
{
cout<<"You are in a small room with two exits."<<endl;
} }
}
getch();
return 0;
}
Note: I am a very new programmer. I don't even know what getch is, but I was working of someone elses program as a model.
------------------
And so the problem remained; lots of people were mean, and most of them were miserable, even the ones with digital watches. Many were increasingly of the opinion that they had all made a big mistake in coming down from the trees in the first place. And some said that the trees had been a bad move and that no one should ever have left the oceans. - Douglass Adams