Hello,
I am in Intro C++ class & I have to create a "RPG" (role play game). I am having some challenges. I have already created a few different variations trying to get progam to run, but I keep breaking stuff when I try to fix it.
So, there are at least 3 menus (main menu, choose warrior, choose weapon) & you must choose options, while a score is awarded, tracked & displayed later. Also, reading/writing to a file, but not worried about that now.
Any advice you can offer will be greatly appreciated! or alternative programs/links/sites/etc...I have searched, but what I have found is all way more advanced than this.
I have below some of what I have done ( I did eliminate some lines):
Thank you so much for your assistance! trendygirl
1 2
|
[code][code]//Introduction
[code]cout<<"
|
\n\nWELCOME TO THE Women Warriors GAME !!\n\n";
cout<<
"Choose from the menu below: \n";
do
{
//reset score
score = 0;
highScore = 0;
randomNumber = 0;
//Display menu
cout<<
"1) Story Line & Rules \n";
cout<<
"2) Play Game \n";
cout<<"
3) Exit \n";
//Prompt the user for menuChoice
cout<<" Enter your choice here: \n";
cin>>menuChoice;
cin.ignore(80,'\n');
do
{
//Display story line
if (menuChoice == 1)
{
cout<<" You have selected to read the Story Line and the Rules.\n";
cout<<" \"Women Warriors!\"\n\n";
cout<<" It is the year 2212…..";
//Display rules
cout<<" The rules of the games are: \n\n";
cout<<" 1. Select your Woman Warrior from the description provided\n";
cout<<" 2. Then you must select your weapon\n";
cout<<" 3. You will be awarded points based on your choices.\n";
cout<<" 4. Your points will be recorded and displayed at the end.\n\n";
}
else if (menuChoice == 2)
{
//Start game play
cout<<" You have chosen to play the \"Women Warriors\" game.\n";
cout<<" Let's Play the Game!\n";
cout<<" Please choose your Warrior!\n";
//Choose A,B,C = choice //type of female warrior
//Revenge Maven, Renegade Rebel, Righteous Ringleader
cout<<" A - Revenge Maven\n";
cout<<" B - Renegade Rebel\n";
cout<<" C - Righteous Ringleader\n";
cin.ignore(80,'\n');
cin.get(choice);
//Display warrior name & attributes
//display invalid
if (choice == 'A')
{
cout<<" You have chosen Revenge Maven, \"Beatrix Kiddo\"!\n";
cout<<" The Bride....\n";
cout<<" Your points are being awarded!\n";
cout<<score<<endl; //show score
}
else if (choice == 'B')
{
cout<<" You have chosen Renegade Rebel, \"Sarah Connor\"!\n";
cout<<" A cyborg assassin....\n";
cout<<score<<endl; //show score
}
else if (choice == 'C')
{
cout<<" You have chosen the Righteous Ringleader, \"Wonder Woman\"!";
cout<<" Wonder Woman ......\n";
cout<<"Your points are being awarded!\n";
//show score
cout<<score<<endl;
}
//validate input
while (choice <= 'A') && (choice >= 'C');
{
cout<<"Invalid, Please enter A, B, C for your menu choice.\n";
cin>>choice;
}
do
{//Choose 1,2,3 = option
//prompt for weapon selection
cout<<" Please choose the weapon you will use to destroy the villian!\n";
cout<<" 1 - The Lariat of Hestia.\n";
cout<<" 2 - A Samurai Sword.\n";
cout<<" 3 - An M-79 Grenade Launcher.\n";
cin>>option;
if (option == 1)
{
cout<<" You have chosen"<<option<<"as your death weapon!\n";
cout<<" Your points are being awarded!\n";
//show score
cout<<score<<endl;
}
else if (option == 2)
{
cout<<" You have chosen"<<option<<"as your death weapon!\n";
cout<<" Your points are being awarded!\n";
//show score
cout<<score<<endl;
}
else if (option == 3)
{
cout<<" You have chosen"<<option<<"as your death weapon!\n";
cout<<" Your points are being awarded!\n";
//show score
cout<<score<<endl;
}
}while (option != 4);
cout<<" You have entered an invalid choice.\n";
cout<<" You must choose 1 - 3 from the menu.\n";
//Calculate points based on choices
if (menuChoice == 'A')
{
score = 500;
cout<<score<<endl;
}
else if (menuChoice == 'B')
{
score = 400;
cout<<score<<endl;
}
else if (menuChoice == 'C')
{
score = 300;
cout<<score<<endl;
}
//show score
cout<<score<<randomNumber<<endl;
//calculate score and random number
highScore = score + randomNumber;
cout<<highScore<<endl;
}
if (menuChoice == 3)
//Display good bye
{
cout<<"\nThank you for playing Warrior Women\n";
cout<<"\nGoodbye.\n";
}
else (menuChoice !=3);
//Invalid
{
cout<<" You have entered an invalid choice.\n";
cout<<" You must choose 1 - 3 from the menu.\n";
cout<<" Please choose 2 if you want to play again!\n\n";
}
} while (menuChoice != 3); //loop again if 3 not selected[/code][/code][/code]