#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;
int main(void)
{
//Title
cout << "======Game (Beta Version 2.0) - By: Bert======\n\n";
//Varibles
int enemyHP=100, enemyPower=200, yourHP=100, yourPower=200, yourCommand, enemyCommand;
int command=0, reset=0;
int yourAttack, enemyAttack;
int yourMoney=200;
while (reset == 1)
//{
//Main Screen
cout << "Please select what you would like to do by typing in the number next to the list of possible commands below.\n\n";
cout << " 1. Battle \n";
cout << " 2. Shop \n";
cout << " 3. Train \n";
cout << " 4. Check Status \n\n";
cin >> command;
//}
//Battle Screen
if (command == 1)
{
//Begin 'while' command
while (yourHP > 0 && enemyHP > 0)
{
//Your turn to attack or defend
cout << "Enter 1 to Attack \n Enter 2 to Defend \n\n";
cin >> yourCommand;
//Processes command
//Command to attack
if (yourCommand == 1)
{
if (yourPower < 15)
{
cout << "You do not have enough Power Points to Attack \n";
cout << "Your HP: " << yourHP << "\n";
cout << "Your PP: " << yourPower << "\n";
cout << "Enemy HP: " << enemyHP << "\n";
cout << "Enemy PP: " <<enemyPower << "\n---\n";
}
yourAttack = rand() % 15;
enemyHP = enemyHP - yourAttack;
yourPower = yourPower - 5;
yourPower = yourPower + 3;
cout << "You have done " << yourAttack << " HP of damage to your opponent and you lost 5 Power Points attacking. But you also gained 3 Power Points during this turn. \n";
cout << "Your HP: " << yourHP << "\n";
cout << "Your PP: " << yourPower << "\n";
cout << "Enemy HP: " << enemyHP << "\n";
cout << "Enemy PP: " <<enemyPower << "\n---\n";
}
//Command to defend
if (yourCommand == 2)
{
if (yourPower < 5)
{
cout << "You do not have enough Power Points to Defend \n";
cout << "Your HP: " << yourHP << "\n";
cout << "Your PP: " << yourPower << "\n";
cout << "Enemy HP: " << enemyHP << "\n";
cout << "Enemy PP: " <<enemyPower << "\n---\n";
}
yourHP = yourHP + 5;
yourPower = yourPower + 5;
cout << "By defending you have gained 5 Power Points. And you have also gained 5 HP. \n";
cout << "Your HP: " << yourHP << "\n";
cout << "Your PP: " << yourPower << "\n";
cout << "Enemy HP: " << enemyHP << "\n";
cout << "Enemy PP: " <<enemyPower << "\n---\n";
}
//Enemy's turn to attack or defend
// Command: If hits are more than 20 then attack
if (enemyHP > 20)
{
enemyCommand = 1;
}
// Command: If hits are less than 20 then defend
if (enemyHP < 20)
{
enemyCommand = 2;
}
//Processes command
if (enemyCommand == 1)
{
enemyAttack = rand() % 15;
yourHP = yourHP - enemyAttack;
enemyPower = enemyPower - 5;
enemyPower = enemyPower + 3;
cout << "Your opponent has taken " << enemyAttack << " HP from you. \n";
cout << "Your HP: " << yourHP << "\n";
cout << "Your PP: " << yourPower << "\n";
cout << "Enemy HP: " << enemyHP << "\n";
cout << "Enemy PP: " <<enemyPower << "\n\n";
}
if (enemyCommand == 2)
{
enemyHP = enemyHP + 5;
enemyPower = enemyPower + 5;
cout << "Since you opponent has decided to defend he gains 5 Power Points and 5 HP. \n";
cout << "Your HP: " << yourHP << "\n";
cout << "Your PP: " << yourPower << "\n";
cout << "Enemy HP: " << enemyHP << "\n";
cout << "Enemy PP: " <<enemyPower << "\n\n";
}
//End 'while' command
}
if (yourHP < 1)
{
cout << "You lost\n";
yourMoney = yourMoney - 50;
}
if (enemyHP < 1)
{
cout << "You won\n";
yourMoney = yourMoney + 50;
reset = 1;
}
}
//Shop Screen
if (command == 2)
{
/*Script added later*/
}
//Train Screen
if (command == 3)
{
/*Script added later*/
}
if (command == 4)
{
cout << "Your HP: " << yourHP << " HP \n";
cout << "Your Power: " << yourPower << " PP \n";
cout << "Your Money: " << "$" << yourMoney << "\n\n";
}
//Invaild Command Screen
else
{
cout << "That is not a vaild command. Please press '1' and then 'enter' to return to the mainscreen.";
cin >> reset;
}
int x;
cin >> x;
return 0;
}
Problem With My Game
I was making a game and when I played it I came across a problem. Below is the code.
As you can probally see it isn't finished yet. Anyways, when I complied it and went into "battle", at the end, it didn't go back to the mainscreen like it was suppose to. It goes to the "Invaild Command Screen". As you can also probally see in the code, the brackets ({ }) around the mainscreen code has comments on them. I did that because I wanted to temperarily disable that part in case I wanted to added it later. Without the comment tags, when I complied and played it, the screen would display the "Invaild Command Screen".
Can you please help me?
[edited by - bert2 on July 14, 2002 8:41:28 PM]
Hi everyone!
Have you tried stepping through it with your debugger?
(You do have a debugger, right?)
Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net
(You do have a debugger, right?)
Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
Check all your ({ }) brackets and make sure u have an even number of them.
1)how come this part is not commented out?
while (reset == 1)
2)I see 2 closing brackets here:
==============================
if (enemyHP < 1) {cout << "You won\n";
yourMoney = yourMoney + 50;
reset = 1;
}
}
==================================
You might want to make small functions so your source code can
be more modular. And/or, instead of all the IF/ELSE statements you may want to use a CASE/SWITCH statment. Good Luck!!!
-----------------------------
"There are ones that say they can and there are those who actually do."
"...u can not learn programming in a class, you have to learn it on your own."
1)how come this part is not commented out?
while (reset == 1)
2)I see 2 closing brackets here:
==============================
if (enemyHP < 1) {cout << "You won\n";
yourMoney = yourMoney + 50;
reset = 1;
}
}
==================================
You might want to make small functions so your source code can
be more modular. And/or, instead of all the IF/ELSE statements you may want to use a CASE/SWITCH statment. Good Luck!!!
-----------------------------
"There are ones that say they can and there are those who actually do."
"...u can not learn programming in a class, you have to learn it on your own."
-----------------------------"There are ones that say they can and there are those who actually do.""...u can not learn programming in a class, you have to learn it on your own."
Here is the code , but I suggest you to use switch instead of if's
I've put a getch() in the end of each "option" to wait for an input key from the user you can display a message to the user to press any key
[edited by - Homer Simpson on July 14, 2002 9:27:35 PM]
#include <iostream>#include <stdlib.h>#include <stdio.h>#include <time.h>#include <conio.h>using namespace std;void mainscreen(int &command);int main(void){ int enemyHP=100, enemyPower=200, yourHP=100, yourPower=200, yourCommand, enemyCommand; int command=0, reset=0; int yourAttack, enemyAttack; int yourMoney=200; do { command=0; mainscreen(command); //Battle Screen if (command == 1) { //Begin 'while' commandwhile (yourHP > 0 && enemyHP > 0) { //Your turn to attack or defend cout << "Enter 1 to Attack \n Enter 2 to Defend \n\n"; cin >> yourCommand; //Processes command //Command to attack if (yourCommand == 1) { if (yourPower < 15) { cout << "You do not have enough Power Points to Attack \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } yourAttack = rand() % 15; enemyHP = enemyHP - yourAttack; yourPower = yourPower - 5; yourPower = yourPower + 3; cout << "You have done " << yourAttack << " HP of damage to your opponent and you lost 5 Power Points attacking. But you also gained 3 Power Points during this turn. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } //Command to defend if (yourCommand == 2) { if (yourPower < 5) { cout << "You do not have enough Power Points to Defend \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } yourHP = yourHP + 5; yourPower = yourPower + 5; cout << "By defending you have gained 5 Power Points. And you have also gained 5 HP. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } if(yourCommand!=1&&yourCommand!=2){ break; getch();} //Enemy's turn to attack or defend // Command: If hits are more than 20 then attack if (enemyHP > 20) { enemyCommand = 1; } // Command: If hits are less than 20 then defend if (enemyHP < 20) { enemyCommand = 2; } //Processes command if (enemyCommand == 1) { enemyAttack = rand() % 15; yourHP = yourHP - enemyAttack; enemyPower = enemyPower - 5; enemyPower = enemyPower + 3; cout << "Your opponent has taken " << enemyAttack << " HP from you. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n\n"; } if (enemyCommand == 2) { enemyHP = enemyHP + 5; enemyPower = enemyPower + 5; cout << "Since you opponent has decided to defend he gains 5 Power Points and 5 HP. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n\n"; } //End 'while' command } if (yourHP < 1) { cout << "You lost\n"; yourMoney = yourMoney - 50; } if (enemyHP < 1) { cout << "You won\n"; yourMoney = yourMoney + 50; reset = 1; } } //Shop Screen if (command == 2) { /*Script added later*/ getch(); } //Train Screen if (command == 3) { /*Script added later*/ getch(); } if (command == 4) { cout << "Your HP: " << yourHP << " HP \n"; cout << "Your Power: " << yourPower << " PP \n"; cout << "Your Money: " << "$" << yourMoney << "\n\n"; getch(); } //Invaild Command Screen else { cout << "That is not a vaild command. Please press 'enter' to return to the mainscreen."; getch(); } }while(1); getch();return 0; }void mainscreen(int &command){ system("cls"); //Title cout << "======Game (Beta Version 2.0) - By: Bert======\n\n"; //Varibles cout << "Please select what you would like to do by typing in the number next to the list of possible commands below.\n\n"; cout << " 1. Battle \n"; cout << " 2. Shop \n"; cout << " 3. Train \n"; cout << " 4. Check Status \n\n"; cin >> command; }
I've put a getch() in the end of each "option" to wait for an input key from the user you can display a message to the user to press any key
[edited by - Homer Simpson on July 14, 2002 9:27:35 PM]
__________________::Homer Simpson::
I think you better learn some more C++ before you start coding a game, even a simple text based one.
I have noticed that the entire game is built in the main function where there is clearly repeated code that you could put into seperate functions.
There should be methods for displaying the health of the player and the enemy. There should be data structures for a lot of stuff. There should be.. blah blah blah
-SniperBoB-
I have noticed that the entire game is built in the main function where there is clearly repeated code that you could put into seperate functions.
There should be methods for displaying the health of the player and the enemy. There should be data structures for a lot of stuff. There should be.. blah blah blah
-SniperBoB-
Brandon Bloomhttp://brandonbloom.name
Hello,
The problem that I see is that if the command is '1' it catches it in the first 'if' statement. and that's fine. but since you are not using 'if else' for the next 'if' statements it will check the 'if' statement for command '4' and see that it is not equal to command '4' and run the 'else' part of the 'if', which is the 'invalid command' statement.... therefore....
you should either do...
or use a switch statement, which is what i'd perfer...
hope this helps...
keep programming
DarkMonkey
[edited by - DarkMonkey on July 14, 2002 9:40:01 PM]
The problem that I see is that if the command is '1' it catches it in the first 'if' statement. and that's fine. but since you are not using 'if else' for the next 'if' statements it will check the 'if' statement for command '4' and see that it is not equal to command '4' and run the 'else' part of the 'if', which is the 'invalid command' statement.... therefore....
you should either do...
if(command == 1){...} else if(command == 2) {...} else if(command == 3) {...} else if(command == 4) {...} else { cout << "invalid command..." << endl; }
or use a switch statement, which is what i'd perfer...
switch(command) { case 1: // do something break; case 2: // do something break; case 3: // do something break; case 4: // do something break; default: // invalid command cout << "Invalid command. Try again... " << endl; break; }
hope this helps...
keep programming
DarkMonkey
[edited by - DarkMonkey on July 14, 2002 9:40:01 PM]
cMADsc: I didn't comment out-
while (reset == 1)
-because I wanted it so that when "reset" is set to "1" it goes back to the mainscreen. Like so that at the end of a battle it goes back to the mainscreen so the player can do other stuff.
superpig: I tried my debugger, but a message pop-ed up saying that there was a problem debugging.
Anyways:
I fixed that problem. I took your suggestion and used switch statements. But now, there's another problem. When I enter a battle, when I leave it takes me back to the Menu, good so far. But when I decide to enter a battle again it displays "You won!..." or "You Lost...", instead of reseting the battle so you can battle again. How can I fix this? Here is the code:
[edited by - bert2 on July 15, 2002 9:27:22 PM]
while (reset == 1)
-because I wanted it so that when "reset" is set to "1" it goes back to the mainscreen. Like so that at the end of a battle it goes back to the mainscreen so the player can do other stuff.
superpig: I tried my debugger, but a message pop-ed up saying that there was a problem debugging.
Anyways:
I fixed that problem. I took your suggestion and used switch statements. But now, there's another problem. When I enter a battle, when I leave it takes me back to the Menu, good so far. But when I decide to enter a battle again it displays "You won!..." or "You Lost...", instead of reseting the battle so you can battle again. How can I fix this? Here is the code:
#include <iostream>#include <stdlib.h>#include <stdio.h>#include <time.h>int menu();//Command Functionsvoid battle();void shop();void train();void check_status();//Variblesint enemyHP=100, enemyPower=200, yourHP=100, yourPower=200, yourCommand, enemyCommand;int yourAttack, enemyAttack;int yourMoney=200;int battleReset=0;using namespace std;int main(void){ bool exit = false; for (;;) { int choice = menu(); switch(choice) { case (1): battle(); break; case (2): shop(); break; case (3): train(); break; case (4): check_status(); break; case (5): exit = true; break; default: cout << "Invaild Command. Please select again.\n\n"; break; } if (exit) break; } return 0;}int menu(){int choice;cout << "**** Menu ****\n\n";cout << "(1) Battle \n";cout << "(2) Shop \n";cout << "(3) Train \n";cout << "(4) Check Status \n";cout << "(5) Quit \n";cout << ": ";cin >> choice;return choice;}//Functions//Battlevoid battle(){while (yourHP > 0 && enemyHP > 0) { //Your turn to attack or defend cout << "Enter 1 to Attack \n Enter 2 to Defend \n\n"; cin >> yourCommand; //Processes command //Command to attack { if (yourPower < 15) { cout << "You do not have enough Power Points to Attack \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } yourAttack = rand() % 15; enemyHP = enemyHP - yourAttack; yourPower = yourPower - 5; yourPower = yourPower + 3; cout << "You have done " << yourAttack << " HP of damage to your opponent and you lost 5 Power Points attacking. But you also gained 3 Power Points during this turn. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } //Command to defend if (yourCommand == 2) { if (yourPower < 5) { cout << "You do not have enough Power Points to Defend \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } yourHP = yourHP + 5; yourPower = yourPower + 5; cout << "By defending you have gained 5 Power Points. And you have also gained 5 HP. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n---\n"; } //Enemy's turn to attack or defend // Command: If hits are more than 20 then attack if (enemyHP > 20) { enemyCommand = 1; } // Command: If hits are less than 20 then defend if (enemyHP < 20) { enemyCommand = 2; } //Processes command if (enemyCommand == 1) { enemyAttack = rand() % 15; yourHP = yourHP - enemyAttack; enemyPower = enemyPower - 5; enemyPower = enemyPower + 3; cout << "Your opponent has taken " << enemyAttack << " HP from you. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n\n"; } if (enemyCommand == 2) { enemyHP = enemyHP + 5; enemyPower = enemyPower + 5; cout << "Since you opponent has decided to defend he gains 5 Power Points and 5 HP. \n"; cout << "Your HP: " << yourHP << "\n"; cout << "Your PP: " << yourPower << "\n"; cout << "Enemy HP: " << enemyHP << "\n"; cout << "Enemy PP: " <<enemyPower << "\n\n"; } //End 'while' command } if (yourHP < 1) { cout << "You lost! \n"; cout << "(1) Battle Again\n"; cout << "(2) Exit Battle Room\n"; yourMoney = yourMoney - 50; cin >> battleReset; } if (enemyHP < 1) { cout << "You won! \n"; cout << "(1) Battle Again\n"; cout << "(2) Exit Battle Room\n"; yourMoney = yourMoney + 50; cin >> battleReset; }}//Shopvoid shop(){}//Trainvoid train(){}//Check Statusvoid check_status(){ cout << "Your HP: " << yourHP << " HP \n"; cout << "Your Power: " << yourPower << " PP \n"; cout << "Your Money: " << "$" << yourMoney << "\n\n";}
[edited by - bert2 on July 15, 2002 9:27:22 PM]
Hi everyone!
Sorry if I''m ignorant here. Just learning classes and I want to learn.
In that last bit of code, would it pay off to use classes? Like for the variables declared at the beginning.
Thanks
In that last bit of code, would it pay off to use classes? Like for the variables declared at the beginning.
Thanks
Nevermind, I found the problem.
Tenshu: I''m not sure. I''ve never used classes in a program before.
Tenshu: I''m not sure. I''ve never used classes in a program before.
Hi everyone!
I took the liberty of converting some of that to classes.
Thanks for the code. It was very helpful, and I learned very much
[edited by - Tenshu on July 18, 2002 10:50:08 AM]
Thanks for the code. It was very helpful, and I learned very much
#include <iostream>#include <stdlib.h>#include <stdio.h>#include <time.h>int menu();//Command Functionsvoid battle();void shop();void train();void check_status();//Variblesclass cStatus{public: int GetHitPoints(); int GetPower(); void SetHitPoints(int HP); void SetPower(int Pow); cStatus(int HitPoints, int Power); ~cStatus();private: int HitPoints; int Power;};int yourCommand, enemyCommand;int yourAttack, enemyAttack;int yourMoney=200;int battleReset=0;using namespace std;//Class stuffint cStatus::GetHitPoints(){ return HitPoints;}int cStatus::GetPower(){ return Power;}void cStatus::SetHitPoints(int HP){ HitPoints=HP;}void cStatus::SetPower(int Pow){ Power=Pow;}cStatus::cStatus(int InitialHitPoints, int InitialPower){ HitPoints=InitialHitPoints; Power=InitialPower;}cStatus::~cStatus(){}cStatus You(100,200), Enemy(100,200);//This is where the action isint main(void){ bool exit = false; for (; { int choice = menu(); switch(choice) { case (1): battle(); break; case (2): shop(); break; case (3): train(); break; case (4): check_status(); break; case (5): exit = true; break; default: cout << "Invalid Command. Please select again.\n\n"; break; } if (exit) break; } return 0;}int menu(){int choice;cout << "**** Menu ****\n\n";cout << "(1) Battle \n";cout << "(2) Shop \n";cout << "(3) Train \n";cout << "(4) Check Status \n";cout << "(5) Quit \n";cout << ": ";cin >> choice;return choice;}//Functions//Battlevoid battle(){while (You.GetHitPoints() > 0 && Enemy.GetHitPoints() > 0) { //Your turn to attack or defend cout << "Enter 1 to Attack \n Enter 2 to Defend \n\n"; cin >> yourCommand; //Processes command //Command to attack { if (You.GetPower() < 15) { cout << "You do not have enough Power Points to Attack \n"; cout << "Your HP: " << You.GetHitPoints() << "\n"; cout << "Your PP: " << You.GetPower() << "\n"; cout << "Enemy HP: " << Enemy.GetHitPoints() << "\n"; cout << "Enemy PP: " < } yourAttack = rand() % 15; Enemy.SetHitPoints(Enemy.GetHitPoints() - yourAttack); You.SetPower(You.GetPower() - 5); You.SetPower(You.GetPower() + 3); cout << "You have done " << yourAttack << " HP of damage to your opponent and you lost 5 Power Points attacking. But you also gained 3 Power Points during this turn. \n"; cout << "Your HP: " << You.GetHitPoints() << "\n"; cout << "Your PP: " << You.GetPower() << "\n"; cout << "Enemy HP: " << Enemy.GetHitPoints() << "\n"; cout << "Enemy PP: " < } //Command to defendif (yourCommand == 2) { if (You.GetPower() < 5) { cout << "You do not have enough Power Points to Defend \n"; cout << "Your HP: " << You.GetHitPoints() << "\n"; cout << "Your PP: " << You.GetPower() << "\n"; cout << "Enemy HP: " << Enemy.GetHitPoints() << "\n"; cout << "Enemy PP: " < } You.SetHitPoints(You.GetHitPoints() + 5); You.SetPower(You.GetPower() + 5); cout << "By defending you have gained 5 Power Points. And you have also gained 5 HP. \n"; cout << "Your HP: " << You.GetHitPoints() << "\n"; cout << "Your PP: " << You.GetPower() << "\n"; cout << "Enemy HP: " << Enemy.GetHitPoints() << "\n"; cout << "Enemy PP: " < } //Enemy's turn to attack or defend // Command: If hits are more than 20 then attack if (Enemy.GetPower() > 20) { enemyCommand = 1; } // Command: If hits are less than 20 then defend if (Enemy.GetHitPoints() < 20) { enemyCommand = 2; } //Processes command if (enemyCommand == 1) { enemyAttack = rand() % 15; You.SetHitPoints(You.GetHitPoints() - enemyAttack); Enemy.SetPower(Enemy.GetPower() - 5); Enemy.SetPower(Enemy.GetPower() + 3); cout << "Your opponent has taken " << enemyAttack << " HP from you. \n"; cout << "Your HP: " << You.GetHitPoints() << "\n"; cout << "Your PP: " << You.GetPower() << "\n"; cout << "Enemy HP: " << Enemy.GetHitPoints() << "\n"; cout << "Enemy PP: " < } if (enemyCommand == 2) { Enemy.SetHitPoints(Enemy.GetHitPoints() + 5); Enemy.SetPower(Enemy.GetPower() + 5); cout << "Since you opponent has decided to defend he gains 5 Power Points and 5 HP. \n"; cout << "Your HP: " << You.GetHitPoints() << "\n"; cout << "Your PP: " << You.GetPower() << "\n"; cout << "Enemy HP: " << Enemy.GetHitPoints() << "\n"; cout << "Enemy PP: " < } //End 'while' command } if (You.GetHitPoints() < 1) { cout << "You lost! \n"; cout << "(1) Battle Again\n"; cout << "(2) Exit Battle Room\n"; yourMoney = yourMoney - 50; cin >> battleReset; } if (Enemy.GetHitPoints() < 1) { cout << "You won! \n"; cout << "(1) Battle Again\n"; cout << "(2) Exit Battle Room\n"; yourMoney = yourMoney + 50; cin >> battleReset; }}//Shopvoid shop(){}//Trainvoid train(){}//Check Statusvoid check_status(){ cout << "Your HP: " << You.GetHitPoints() << " HP \n"; cout << "Your Power: " << You.GetPower() << " PP \n"; cout << "Your Money: " << "$" << yourMoney << "\n\n";}
[edited by - Tenshu on July 18, 2002 10:50:08 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement