Im not very good with fstream yet but you dont need to use
std::
aslong as you have
using namespace std;
Im not very good with fstream yet but you dont need to use
std::
aslong as you have
using namespace std;
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 << …
Ok im making a Text based RPG and its going to take quite a while to be able to beat the game. So i want to allow the person to save and load games, how can i make this happen?
Hold on but if i use char gmOption and then have like.
if (gmOption == New Game)
{
RaceClass();
}
if (gmOption == Cheats)
{
Cheats();
}
Would that work? Cuase it doesnt.
Im trying to create a Text Based Game and i want to have a 'Game Menu'. This is my code but i dont know exactly how to make the menu. Please Help! I also wouldnt mind if some can tell me how i would be able to integrate a cheat into this.
#include "Library.h"
using namespace std;
void Intro();
void RaceClass();
void Cheats();
int main()
{
HANDLE hOut;
hOut = GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleTextAttribute (hOut, FOREGROUND_RED);
cout << "\t Vitium Victoria \n\n";
SetConsoleTextAttribute (hOut, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
cout << "Programmed by";
SetConsoleTextAttribute (hOut, FOREGROUND_RED);
cout << "\t Kile Exley \n";
SetConsoleTextAttribute (hOut, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
cout << "Written by";
SetConsoleTextAttribute (hOut, FOREGROUND_RED);
cout << "\t Bryan Exley\n\n\n";
SetConsoleTextAttribute (hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
Intro();
SetConsoleTextAttribute (hOut, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
cout << "\n\n";
system("PAUSE");
return 0;
}
void Intro()
{
HANDLE hOut;
hOut = GetStdHandle (STD_OUTPUT_HANDLE);
char charName[32];
int userRace;
int userClass;
char gmOption;
cout << "Welcome to the world of Vitium Victoria!\n";
cout << "Here you shall find adventures and horrors alike.\n";
cout << "The world is brimming with nightmares waiting to be dreamt;\n";
cout << "treasures and quests waiting to be sought, and fantastical journies to be had!\n\n";
SetConsoleTextAttribute (hOut, FOREGROUND_RED);
cout << "\t Game Menu\n";
SetConsoleTextAttribute (hOut, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | BACKGROUND_RED | BACKGROUND_GREEN);
cout << "1 - New Game\n";
cout << "2 - Load\n";
cout << "3 - Cheats\n";
cin >> gmOption;
if (gmOption == 1)
{
RaceClass(); …