Hello, I have started making a text adventure game, I need help with some code.
if (Choice == 2)
{
cout << "" << endl << "You follow the light to the end of the hallway, you find your self in a room" << endl
<< "with natural light coming from a hole in the ceiling." << endl << "" << endl << "You hear the door you just came through, slam behind you!" << endl << "" << endl
<< "There are three possible directions." << endl << "" << endl << "Do you:" << endl << "" << endl << "1) Go forward" << endl << "" << endl << "2) Go left" << endl
<< "" << endl << "3) Go right" << endl << "" << endl << "Enter your choice: ";
scanf("%d" , &Choice );
}
if (Choice == 1)
{
cout << endl << "" << endl << "In the dim light you see a glint of white teeth, they lunge toward you and take a bite out of your neck. You die." << endl << "" << endl;
system("pause");
return 0;
}
if (Choice == 2)
{
cout << endl << "" << endl << "As you walk down a dimly lit hallway, you catch a bit of light reflecting off" << endl << "" << endl << "some metal. It's a chest!" << endl << ""
<< endl << "Do you:" << endl << "" << endl << "1) Go back" << endl << "" << endl << "2) Open the chest" << endl << "" << endl <<
"Enter your choice: ";
scanf("%d" , Choice);
}
Ignore the if (Choice == 2) at the beginning, that's linked to some previous code.
I want to make the player go back to the first bit of text but i'm not sure how to do this if they keep choosing to go back and forth from one location.
I first thought of doing it by just putting the text back in after they have chosen the option, but I can't do this infinite times.