Follow along with the video below to see how to install our site as a web app on your home screen.
Note: this_feature_currently_requires_accessing_site_using_safari
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int player = 10;
int NPC = 10;
int attack1;
cout << "Welcome to battle!\nTo attack press 1\nTo block press 2.\n";
cin >> attack1;
if (attack1 == 1)
{
for (;;)
{
if (attack1 == 1)
{
NPC = NPC - 2;
player = player - 3;
cout << "ATTACK!\nYou attacked and lost 3HP.\nThe NPC lost 2HP from your attack\nYou have "
<< player
<< "HP.\nThe NPC has "
<< NPC
<< "HP.\nTo attack press 1\nTo block press 2.\n";
int attack2a;
cin >> attack2a;
if (attack2a == 1)
{
NPC = NPC - 2;
player = player - 3;
cout << "ATTACK!\nYou attacked and lost 3HP.\nThe NPC lost 2HP from your attack\nYou have "
<< player
<< "HP.\nThe NPC has "
<< NPC
<< "HP.\nTo attack press 1\nTo block press 2.\nOr to run away press 3.\n";
}
if (attack2a == 2)
{
player = player - 2;
cout << "Your block was somewhat effective and you only lost 2HP as opposed to 3HP.\nYou have "
<< player
<< "HP\nThe NPC has "
<< NPC
<< "HP.\nIt is no longer possible to win with the current scores.";
break;
}
int attack3a;
cin >> attack3a;
if (attack3a == 3)
{
cout << "You run away and the NPC runs out of breath and loses.\nYou have won, thank you for playing.\nProgrammed by Steven C. Berry.\n";
break;
}
if (attack3a == 1)
{
NPC = NPC - 2;
player = player - 4;
cout << "ATTACK!\nYou attacked and lost 4HP.\nThe NPC lost 2HP from your attack\nYou have "
<< player
<< "HP.\nThe NPC has"
<< NPC
<< "HP\nYou have lost better luck next time.\n";
system("PAUSE");
break;
}
if (attack3a == 2)
{
player = player - 4;
cout << "BLOCK!\nYour attack was useless and you lost 4HP.\nThe player has "
<< player
<< "HP.\nThe NPC has "
<< NPC
<< "HP.\nYou have lost better luck next time.\n";
break;
}
}
}
system("PAUSE");
return 0;
}
}
}
theSteven said:I realy cant be botherd hosting it but I'll just post the source code.
T'is very basic and the only way to win is by pressing 3 to run away when it asks you.Code:#include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(int nNumberofArgs, char* pszArgs[]) { int player = 10; int NPC = 10; int attack1; cout << "Welcome to battle!\nTo attack press 1\nTo block press 2.\n"; cin >> attack1; if (attack1 == 1) { for (;;) { if (attack1 == 1) { NPC = NPC - 2; player = player - 3; cout << "ATTACK!\nYou attacked and lost 3HP.\nThe NPC lost 2HP from your attack\nYou have " << player << "HP.\nThe NPC has " << NPC << "HP.\nTo attack press 1\nTo block press 2.\n"; int attack2a; cin >> attack2a; if (attack2a == 1) { NPC = NPC - 2; player = player - 3; cout << "ATTACK!\nYou attacked and lost 3HP.\nThe NPC lost 2HP from your attack\nYou have " << player << "HP.\nThe NPC has " << NPC << "HP.\nTo attack press 1\nTo block press 2.\nOr to run away press 3.\n"; } if (attack2a == 2) { player = player - 2; cout << "Your block was somewhat effective and you only lost 2HP as opposed to 3HP.\nYou have " << player << "HP\nThe NPC has " << NPC << "HP.\nIt is no longer possible to win with the current scores."; break; } int attack3a; cin >> attack3a; if (attack3a == 3) { cout << "You run away and the NPC runs out of breath and loses.\nYou have won, thank you for playing.\nProgrammed by Steven C. Berry.\n"; break; } if (attack3a == 1) { NPC = NPC - 2; player = player - 4; cout << "ATTACK!\nYou attacked and lost 4HP.\nThe NPC lost 2HP from your attack\nYou have " << player << "HP.\nThe NPC has" << NPC << "HP\nYou have lost better luck next time.\n"; system("PAUSE"); break; } if (attack3a == 2) { player = player - 4; cout << "BLOCK!\nYour attack was useless and you lost 4HP.\nThe player has " << player << "HP.\nThe NPC has " << NPC << "HP.\nYou have lost better luck next time.\n"; break; } } } system("PAUSE"); return 0; } } }
Yeah not really Half-Life 2 but it's still a game and thanks.So it's pretty much an algorithm where pressing 3 breaks you out of the "OMFG PWNED" cycle?
Tis simple, but looks interesting.
The begginings of a [hopefully] great game designer.