Sign in to follow this  
  • entries
    78
  • comments
    138
  • views
    35518

Entry 3: My Text RPG

Sign in to follow this  

124 views

Well I'm back with my update! I was supposed to work on the Battle System but I ended up reprogramming the Menu System because it simply would be way too hard to add anything new later on, so I just made it all inside a class which is working great. So far I've setup everything I had before and I added in the HP Restore feature. The only thing I need to do is update the HP for PlayerOne which I'm going to finish right after I write this entry up. So far it checks to see how much Gold you have, then if you have enough to buy Healing it goes into the Healing Function which deducts the amount in Gold then returns the change. Thank goodness for references! I just did a few tests to insure it really does change by checking PlayerOne's Gold after the Menu is closed off and it worked like a charm!

Here's what I've done with my Menu System so far, still have to add in the shopping feature, along with HP detections for the HP Restore. I also need to setup the Inventory Viewer and Selector to work with my Player's Inventory, which will a piece of cake, just lots of code.


#include "Menu.h"

// Constructor
Menu::Menu(bool MenuSystemActive_TEMP,
string MenuSystemInput_TEMP,
bool BattleMenuSystemActive_TEMP,
string BattleMenuSystemInput_TEMP,
bool InventoryMenuSystemActive_TEMP,
string InventoryMenuSystemInput_TEMP,
bool HealMenuSystemActive_TEMP,
string HealMenuSystemInput_TEMP,
bool ShopMenuSystemActive_TEMP,
string ShopMenuSystemInput_TEMP):

MenuSystemActive(MenuSystemActive_TEMP),
MenuSystemInput(MenuSystemInput_TEMP),
BattleMenuSystemActive(BattleMenuSystemActive_TEMP),
BattleMenuSystemInput(BattleMenuSystemInput_TEMP),
InventoryMenuSystemActive(InventoryMenuSystemActive_TEMP),
InventoryMenuSystemInput(InventoryMenuSystemInput_TEMP),
HealMenuSystemActive(HealMenuSystemActive_TEMP),
HealMenuSystemInput(HealMenuSystemInput_TEMP),
ShopMenuSystemActive(ShopMenuSystemActive_TEMP),
ShopMenuSystemInput(ShopMenuSystemInput_TEMP)
{

}



// ERROR
void Menu::ERROR()
{
cout << "\n\nERROR!";
cin.get();
}

// Not Enough Gold
void Menu::NOT_ENOUGH_GOLD()
{
cout << "\n\nNot Enough Gold!";
cin.get();
}

// Already At Full HP
void Menu::ALREADY_AT_FULL_HP()
{
cout << "\n\nAlready At Full HP!";
cin.get();
}

// Menu
int Menu::MenuSystem(int& MS_PlayerGold_TEMP)
{
while (MenuSystemActive == true)
{
cout << "========\n= Menu =\n========";
cout << "\n\n1 - Battle\n";
cout << "2 - Inventory\n";
cout << "3 - Heal\n";
cout << "4 - Shop\n";
cout << "\n5 - Quit";

cout << "\n\nWaiting For Input: ";
cin >> MenuSystemInput;
cin.get();

// Check Input
if (MenuSystemInput == "1")
{
BattleMenuSystemActive = true;
BattleMenuSystem();
}

else if (MenuSystemInput == "2")
{
// To Do . . .
InventoryMenuSystemActive = true;
InventoryMenuSystem();
}

else if (MenuSystemInput == "3")
{
// To Do . . .
HealMenuSystemActive = true;
MS_PlayerGold_TEMP = HealMenuSystem(MS_PlayerGold_TEMP);
}

else if (MenuSystemInput == "4")
{
// To Do . . .
ShopMenuSystemActive = true;
ShopMenuSystem();
}
else if (MenuSystemInput == "5")
{
// To Do . . .
MenuSystemActive = false;
}
else
{
ERROR();
}
system("cls");
}
return MS_PlayerGold_TEMP;
}

// Battle Menu
void Menu::BattleMenuSystem()
{
while (BattleMenuSystemActive == true)
{
system("cls");

cout << "===============\n= Battle Menu =\n===============";
cout << "\n\n1 - Monster List\n";
cout << "2 - Weapon Equip\n";
cout << "3 - Back\n";

cout << "\n\nWaiting For Input: ";
cin >> BattleMenuSystemInput;
cin.get();

if (BattleMenuSystemInput == "1")
{
// To Do . . .
ERROR();
}
else if (BattleMenuSystemInput == "2")
{
// To Do . . .
ERROR();
}
else if (BattleMenuSystemInput == "3")
{
BattleMenuSystemInput = " ";
BattleMenuSystemActive = false;
}
else
{
ERROR();
}
}
}

// Inventory Menu
void Menu::InventoryMenuSystem()
{
while (InventoryMenuSystemActive == true)
{
system("cls");

cout << "==================\n= Inventory Menu =\n==================";
cout << "\n\n1 - View Weapons\n";
cout << "2 - Back\n";

cout << "\n\nWaiting For Input: ";
cin >> InventoryMenuSystemInput;
cin.get();

if (InventoryMenuSystemInput == "1")
{
// To Do . . .
ERROR();
}
else if (InventoryMenuSystemInput == "2")
{
InventoryMenuSystemInput = " ";
InventoryMenuSystemActive = false;
}
else
{
ERROR();
}
}
}

// Heal Menu
int Menu::HealMenuSystem(int& HealMS_PlayerGold_TEMP)
{
while (HealMenuSystemActive == true)
{
system("cls");

cout << "=============\n= Heal Menu =\n=============";
cout << "\n\n1 - Heal (20 Gold)\n";
cout << "2 - Back\n";

cout << "\n\nYour Current HP = " << " TO DO . . .\n";
cout << "Your Current Gold = " << HealMS_PlayerGold_TEMP;

cout << "\n\nWaiting For Input: ";
cin >> HealMenuSystemInput;
cin.get();

if (HealMenuSystemInput == "1")
{
if (HealMS_PlayerGold_TEMP >= 100) // ADD FOR HP CHECK --- TO DO . . .
{
HealMS_PlayerGold_TEMP = HealMenuSystemStart(HealMS_PlayerGold_TEMP);
}
else if (HealMS_PlayerGold_TEMP < 100)
{
NOT_ENOUGH_GOLD();
}
}
else if (HealMenuSystemInput == "2")
{
HealMenuSystemInput = " ";
HealMenuSystemActive = false;
}
else
{
ERROR();
}
}
if (HealMenuSystemActive == false)
{
return HealMS_PlayerGold_TEMP;
}
}

// Shop Menu
void Menu::ShopMenuSystem()
{
while (ShopMenuSystemActive == true)
{
system("cls");

cout << "=============\n= Shop Menu =\n=============";
cout << "\n\n1 - Weapon\n";
cout << "2 - Back\n";

cout << "\n\nWaiting For Input: ";
cin >> ShopMenuSystemInput;
cin.get();

if (ShopMenuSystemInput == "1")
{
// To Do . . .
ERROR();
}
else if (ShopMenuSystemInput == "2")
{
ShopMenuSystemInput = " ";
ShopMenuSystemActive = false;
}
else
{
ERROR();
}
}
}

// Heal System Start
int Menu::HealMenuSystemStart(int& HealMSStart_PlayerGold_TEMP)
{
system("cls");
cout << "Healing...\n";
cout << "\n\nWaiting For Input: ";
cin.get();
HealMSStart_PlayerGold_TEMP -= 100;
return HealMSStart_PlayerGold_TEMP;
}







Well I better get back to work! I cannot believe how much work is put into just programming a Text RPG without any graphics! This is going to be a great learning experience in the end.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now