This time I am making a text adventure game.
The problem I'm having is that I choose to look at my user statistics but I want to go back to the last point I chose in the play() function.
Thanks
The problem I'm having is that I choose to look at my user statistics but I want to go back to the last point I chose in the play() function.
Thanks
Code:
/*
NAME: Reflections on Reflections
AUTHOR: Krunoslav Saho
DATE STARTED: 7/28/2003
*/
#include <iostream>
#include <cstdlib>
#include <string>
#include <iomanip>
using namespace std;
/////////////////////////////////////////////////////////////////////////////
struct player_properties
{
string szName;
int health;
int maxHealth;
int strength;
int dexterity;
}pcName, pcHealth, pcMaxHealth, pcStrength, pcDexterity;
/////////////////////////////////////////////////////////////////////////////
struct pcAction
{
int action;
}pcOption;
/////////////////////////////////////////////////////////////////////////////
void play();
void story();
void name();
void stats();
void inventory();
/////////////////////////////////////////////////////////////////////////////
int main()
{
int option=0;
cout << "1. Play Game" << endl;
cout << "Enter the corresponding number to continue: ";
cin >> option;
if(option == 1)
{
name();
}
system("Pause");
return 0;
}
/////////////////////////////////////////////////////////////////////////////
void play()
{
cout << "It is a dark and stormy night, the wind howls on the trees" << endl
<< "like the cry of a banshee. However, something doesn't feel right..." << endl
<< "You walk over to the window and stare at the window." << endl
<< "you notice there is a reflection in it, you notice a smell of rum." << endl;
cout << "What will you do?" << endl;
cout << "1. Equip Items" << endl;
cout << "2. Discriminate" << endl;
cout << "3. Look at player statistics" << endl << "Select Option: ";
cin >> pcOption.action;
switch(pcOption.action)
{
case 1:
inventory();
break;
case 2:
cout << "You are in the living room of your mansion." << endl
<< "The room reaks of rum. You feel a presence in the kitchen." << endl;
break;
case 3:
stats();
break;
}
}
/////////////////////////////////////////////////////////////////////////////
void name()
{
cout << "Please enter your name: ";
cin >> pcName.szName;
cout << "Welcome " << pcName.szName << endl;
play();
}
/////////////////////////////////////////////////////////////////////////////
void story()
{
}
/////////////////////////////////////////////////////////////////////////////
void stats()
{
pcHealth.health = 10;
pcMaxHealth.maxHealth = 10;
pcStrength.strength = 7;
pcDexterity.dexterity = 4;
cout << "Name: " << pcName.szName << endl;
cout << "Health: " << pcHealth.health << "/" << pcMaxHealth.maxHealth <<endl;
cout << "Strength: " << pcStrength.strength << endl;
cout << "Dexterity: " << pcDexterity.dexterity << endl;
}
/////////////////////////////////////////////////////////////////////////////
void inventory()
{
}
/////////////////////////////////////////////////////////////////////////////