Ok, im making a Text Based RPG and well just look at my problem.
#include "Library.h"
using namespace std;
//Constant Integers
//Functions
void StartGame();
void LoadGame();
void Berkshire();
void Game_Menu();
//Integers
int Gold = 0;
int Health = 20;
int Energy = 20;
int Mana = 10;
int numItems = 0;
int Salary = 2;
//Arrays
char Game[4];
//Strings
string Name;
string Menuopt;
string Inventory[5];
string Body[6];
int main()
{
//Welcome Screen
cout << "\t\tWelcome to the world or Hilvale!\n\n";
cout << "\t\t Created by Kile Exley\n\n";
system("PAUSE");
system("CLS");
Game_Menu();
cout << "\n";
system("PAUSE");
return 0;
}
void Game_Menu()
{
//Game Menu
cout << "\t\t|-----------|\n";
cout << "\t\t| Game Menu |\n";
cout << "\t\t|-----------|\n\n\n";
cout << "New (Game)\n";
cout << "Load (Game)\n\n";
cin >> Menuopt;
if (Menuopt == "New")
{
StartGame();
}
if (Menuopt == "Load")
{
LoadGame();
}
else
{
system("CLS");
Game_Menu();
}
}
void StartGame()
{
system("CLS");
cout << "You have started a New Game\n\n";
cout << "What is your name?\n";
cin >> Name;
system("PAUSE");
Berkshire();
}
void LoadGame()
{
cout << "\nWhat game should be loaded?\n\n";
}
void Berkshire()
{
system("CLS");
cout << "Welcome " << Name << ", to Berkshire!\n\n";
cout << "Where would you like to go?\n";
cout << "Work (Gain " << Salary << " Gold)\n";
cout << "Inn (Heal)\n";
cout << "Potion (Shop)\n";
cout << "Armor (Shop)\n";
cin >> Menuopt;
if (Menuopt == "Work")
{
system("CLS");
if (Energy >= 5, Energy -= 5)
{
cout << "You earned " << Salary << " Gold, you now have " << Energy << " Energy\n";
system("PAUSE");
return Berkshire();
}
if (Energy < 5)
{
cout << "You only have " << Energy << ", you need 5 to be able to work\n";
}
}
else
{
Berkshire();
}
}
Heres what happens after i use up all my Energy (20) from working 3 times after i try to do it a fourth instead of saying that you dont have enough energy it just goes to the Game Menu. Please help me.