Or maybe you don't.
Whatever, I made this so I could dump my projects on you, and maybe you can share yours too!
-----------------------
As I hope you know, I'm a real newbie noob when it comes to programming, and the only language I can write is C++ (and therefore some C# too).
#1:
I made a game, it took me about 2 days to do and it's
not finished, I've also
DUMPED this project because it is poorly structured and is inefficient.
I'm currently remaking it all snazzy like, so I might post that once it's done. This code should actually work, but like I said, the game is not finished.
The basic plot is nothing really, Joe Weller is a kid at our school who no-one likes, and The General, Pears and Menergy are little memes me and kill1704 have.
Don't go reading for the cheat button before you play the game you hackers!
Please note, once Pears comes into play, the game loops endlessly, so have fun with that.
C++ code:
#include <iostream>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <conio.h>
#include <ctime>
#include <Windows.h>
using namespace std;
using std::string;
int UserHP = 100;
int EnemyHP = 150;
int iDamageToEnemy;
int iDamage = rand() % 20 + 10;
bool apples = true;
bool piez = true;
int g = 1;
int p = 1;
int e = 1;
int m;
int v = 0;
int iLifeUp = 0;
int iJoeAttack = 10;
int iLewisHealth = 50;
int NoLewis = 0;
int iGeneral;
int iGeneralAttack = 0;
int GeneralHealth = 250;
int PearsHealth = 150;
int PearsAttack = 5;
string iPlayersName;
int GeneralPears ()
{
//Game loop for you and Pears vs The General
system("cls");
cout << "Pears threw you some Menergy!" << endl;
Sleep (1500);
system("cls");
cout << "+70 HP" << endl;
Sleep(250);
UserHP += 25;
Sleep(250);
UserHP += 25;
Sleep(250);
UserHP += 25;
Sleep(250);
system("cls");
if (iLifeUp > 2)
{
cout << "Plus " << iLifeUp / 2 << " recovers!" << endl;
iLifeUp = iLifeUp / 2;
}
Sleep(1000);
UserHP = 100;
system("cls");
do {
cout << "a = attack, r = recover(" << iLifeUp << "/10)" << endl;
cout << "You: " << UserHP << "Pears: " << PearsHealth << " " << "The General: " << GeneralHealth << endl;
char l;
cin >> l;
switch (l)
{
case 'a':
case 'A':
cout << "You attack!" << endl;
Sleep(500);
GeneralHealth -= iDamage;
break;
case 'r':
case 'R':
if (iLifeUp < 10)
{
cout << "Recover!" << endl;
Sleep(500);
UserHP += 20;
++iLifeUp;
} else {
cout << "Can't recover!" << endl;
}
break;
case 'l':
case 'L':
cout << "!OMG SEECRIT POWUR!" << endl;
Sleep(250);
do {
GeneralHealth -= 20;
cout << "!OMG SEECRIT POWUR!" << endl;
cout << "The General: " << GeneralHealth << endl;
system("cls");
}while (EnemyHP > -100);
break;
default:
cout << "Invalid Move!" << endl;
}
system("cls");
if (PearsHealth > 0)
{
int f = rand() % 2;
}
if (GeneralHealth > 20)
{
int iSoldier = 0;
int k = rand() % 5;
int a = rand() % 10;
if (k <= 1)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General laughed manically!" << endl;
Sleep(750);
GeneralHealth += 10;
} else if (k = 2)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General gave you The Look of Recruitment!!!" << endl;
Sleep(750);
if (a <= 3)
{
cout << "You were caught in his gaze!" << endl;
UserHP -= 45 + iGeneralAttack;
Sleep(500);
}else
{
cout << "You managed to look away in time!" << endl;
Sleep(500);
}
} else if (k = 3)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General used his combat knife!" << endl;
Sleep(750);
if (a <= 4)
{
cout << "You dodged it!" << endl;
Sleep(400);
} else
{
UserHP -= 10 + iGeneralAttack;
}
} else if (k = 4)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General used a stimpack!" << endl;
Sleep(500);
cout << "His attack power is raised!" << endl;
Sleep(750);
iGeneralAttack += 5;
} else if (k = 5)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General fired his Heavy Bazooka!" << endl;
Sleep(750);
int iBazooka = rand() % 9;
if (iBazooka <= 1)
{
cout << "You were hit!" << endl;
Sleep(500);
UserHP -= 45;
PearsHealth -= 45;
} else if (iBazooka > 1)
{
cout << "A near miss!" << endl;
Sleep(500);
}
}
system("cls");
}
if (UserHP < 1)
{
cout << "You have been recruited by The General and turned into Joe Weller, Game Over" << endl;
return 0;
}
}while(GeneralHealth > 1);
if (GeneralHealth < 1)
{
cout << "!!!YOU WIN!!!" << endl;
return 0;
}if (UserHP < 1)
{
cout << "You have been recruited by The General and turned into Joe Weller, Game Over" << endl;
return 0;
}
return 0;
}
int Generalandsoldier ()
{
//Game loop for you vs The General and a Soldier
int SoldierHealth = 75;
int iIncriment = 0;
system("cls");
do {
cout << "a = attack, r = recover(" << iLifeUp << "/10)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
char l;
cin >> l;
switch (l)
{
case 'a':
case 'A':
cout << "You attack!" << endl;
Sleep(500);
SoldierHealth -= iDamage;
break;
case 'r':
case 'R':
if (iLifeUp < 10)
{
cout << "Recover!" << endl;
Sleep(500);
UserHP += 20;
++iLifeUp;
} else {
cout << "Can't recover!" << endl;
}
break;
case 'l':
case 'L':
cout << "!OMG SEECRIT POWUR!" << endl;
Sleep(250);
do {
GeneralHealth -= 20;
cout << "!OMG SEECRIT POWUR!" << endl;
cout << "The General " << GeneralHealth << endl;
system("cls");
}while (GeneralHealth > -100);
break;
default:
cout << "Invalid Move!" << endl;
}
system("cls");
if (GeneralHealth > 20)
{
system("cls");
int iSoldier = 0;
int k = rand() % 16;
int a = rand() % 10;
if (k < 4)
{
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
cout << "The General laughed manically!" << endl;
Sleep(750);
GeneralHealth += 10;
} else if (k > 4 && k < 7)
{
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
cout << "The General gave you The Look of Recruitment!!!" << endl;
Sleep(750);
if (a <= 3)
{
cout << "You were caught in his gaze!" << endl;
Sleep(500);
UserHP -= 45 + iGeneralAttack;
}else
{
cout << "You managed to look away in time!" << endl;
Sleep(500);
}
} else if (k > 7 && k < 11)
{
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
cout << "The General used his combat knife!" << endl;
Sleep(750);
if (a <= 4)
{
cout << "You dodged it!" << endl;
Sleep(400);
} else
{
UserHP -= 10 + iGeneralAttack;
}
} else if (k > 11 && k < 14)
{
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
cout << "The General used a stimpack!" << endl;
Sleep(500);
cout << "His attacks power is raised!" << endl;
Sleep(500);
iGeneralAttack += 5;
} else if (k > 14)
{
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
cout << "The General started talking about Call of Duty!" << endl;
Sleep(500);
UserHP -= 5;
GeneralHealth += 5;
}
}
system("cls");
//While the Soldier is alive, -1 health plus iIncriment's value.
//iIncriment increases by 1 every time this is looped.
if (SoldierHealth > 1)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "Soldier: " << SoldierHealth << " " << "The General: " << GeneralHealth << endl;
Sleep(100);
cout << "Soldier attacks!" << endl;
Sleep(500);
UserHP -= 1 + iIncriment;
++iIncriment;
}
system("cls");
if (UserHP < 1)
{
cout << "You have been recruited by The General and turned into Joe Weller, Game Over" << endl;
return 0;
}
}while(SoldierHealth > 1);
return 0;
}
int GeneralBattle ()
{
//You vs The General
system("cls");
iLifeUp = 0;
cout << "Health recovered!" << endl;
Sleep(1000);
UserHP = 100;
system("cls");
do {
cout << "a = attack, r = recover(" << iLifeUp << "/10)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
char l;
cin >> l;
switch (l)
{
case 'a':
case 'A':
cout << "You attack!" << endl;
Sleep(500);
GeneralHealth -= iDamage;
break;
case 'r':
case 'R':
if (iLifeUp < 10)
{
cout << "Recover!" << endl;
Sleep(500);
UserHP += 20;
++iLifeUp;
} else {
cout << "Can't recover!" << endl;
}
break;
case 'l':
case 'L':
cout << "!OMG SEECRIT POWUR!" << endl;
Sleep(250);
do {
GeneralHealth -= 20;
cout << "!OMG SEECRIT POWUR!" << endl;
cout << "The General: " << GeneralHealth << endl;
system("cls");
}while (GeneralHealth > -100);
break;
default:
cout << "Invalid Move!" << endl;
}
system("cls");
if (GeneralHealth > 20)
{
int iSoldier = 0;
int k = rand() % 16;
int a = rand() % 10;
if (k < 4)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General laughed manically!" << endl;
Sleep(750);
GeneralHealth += 10;
} else if (k > 4 && k <= 7)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General gave you The Look of Recruitment!!!" << endl;
Sleep(750);
if (a <= 3)
{
cout << "You were caught in his gaze!" << endl;
UserHP -= 45 + iGeneralAttack;
Sleep(500);
}else
{
cout << "You managed to look away in time!" << endl;
Sleep(500);
}
} else if (k > 7 && k <= 11)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General used his combat knife!" << endl;
Sleep(750);
if (a <= 4)
{
cout << "You dodged it!" << endl;
Sleep(400);
} else
{
UserHP -= 10 + iGeneralAttack;
}
} else if (k > 11 && k <= 14)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General used a stimpack!" << endl;
Sleep(500);
cout << "His attack power is raised!" << endl;
Sleep(750);
iGeneralAttack += 5;
} else if (k > 14)
{
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6)" << endl;
cout << "You: " << UserHP << " " << "The General: " << GeneralHealth << endl;
cout << "The General summoned a soldier to help him!" << endl;
Sleep(1000);
iSoldier = Generalandsoldier ();
}
system("cls");
}
int applepie = 1;
if (UserHP < 1 && applepie < 2)
{
UserHP = 1;
++ applepie;
} else if (UserHP < 1 && applepie > 1)
{
cout << "You have been recruited by The General and turned into Joe Weller, game over" << endl;
}
//If users HP is below 20, run this monologue and move to 'GeneralPears'.
if (UserHP < 20)
{
system("cls");
Sleep(500);
cout << "General: The battle is hopeless, you can't defeat me!" << endl;
Sleep(3000);
cout << "General: I'll finish you with this!" << endl;
Sleep(2500);
cout << "The General used his combat knife!" << endl;
Sleep(1000);
system("cls");
cout << "The knife was deflected! By..." << endl;
Sleep(1000);
cout << "Pears: You won't win this battle General, I'll make sure of it!" << endl;
Sleep(2500);
system("cls");
cout << "Pears joins you in the battle against The General!" << endl;
Sleep(2500);
int t;
t = GeneralPears();
}
}while(GeneralHealth > 1);
if (GeneralHealth < 1)
{
cout << "!!!YOU WIN!!!" << endl;
return 0;
}
return 0;
}
int General ()
{
//Monologue before battling The General
cout << "You watched as the terrible visage of Joe burned away into nothingness," << endl;
Sleep(1000);
cout << "surely the battle had been won..." << endl;
Sleep(2500);
system("cls");
cout << "You turned to leave, but as you did, you heard a chuckling enimating from the" << endl << "darkness..." << endl;
Sleep(3000);
system("cls");
cout << "It was the General!" << endl;
Sleep(2000);
cout << "General: 'Well done, " << iPlayersName << ", I'm impressed!" << endl;
Sleep(3000);
cout << " No-one has ever managed to defeat my Joe before now, you should be proud!'" << endl;
Sleep(3500);
system("cls");
cout << "General: However." << endl;
Sleep (2500);
system("cls");
cout << "General: 'Joe was very valuable to me, and without him my armys will never grow." << endl;
Sleep(3000);
cout << " I can always turn someone into a new Joe, but using someone weak" << endl << "will simply make the new Joe weak too.." << endl;
Sleep(4500);
cout << " So who better, then, to make into my new Joe...'" << endl << " Someone strong... someone.." << endl;
Sleep(4000);
system("cls");
cout << "General: 'Like you!!!'" << endl;
Sleep(3000);
system("cls");
cout << "The General is attacking!!!" << endl;
Sleep(1000);
int GeneralBattlec;
GeneralBattlec = GeneralBattle();
return 0;
}
int Lewis ()
{
//You and Lewis vs Joe
system("cls");
do {
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Lewis: " << iLewisHealth << " " << "Joe Weller: " << EnemyHP << endl;
char l;
cin >> l;
switch (l)
{
case 'a':
case 'A':
cout << "You attack!" << endl;
Sleep(500);
EnemyHP = EnemyHP - iDamage;
break;
case 'r':
case 'R':
if (iLifeUp < 6)
{
cout << "Used recover!" << endl;
Sleep(500);
UserHP = UserHP + 30;
++iLifeUp;
}
break;
case 'l':
case 'L':
cout << "!OMG SEECRIT POWUR!" << endl;
Sleep(250);
do {
EnemyHP -= 20;
cout << "!OMG SEECRIT POWUR!" << endl;
cout << "Joe Weller: " << EnemyHP << endl;
system("cls");
}while (EnemyHP > -100);
break;
default:
cout << "Invalid move!" << endl;
Sleep(500);
}
if (EnemyHP > 0)
{
int k = rand() % 16;
if (k < 4){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Lewis: " << iLewisHealth << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe Weller used latch!" << endl;
Sleep(500);
iLewisHealth -= iJoeAttack;
} else if (k > 4 && k < 8){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Lewis: " << iLewisHealth << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe made a bad joke!" << endl;
Sleep(500);
iLewisHealth -= 5;
EnemyHP += 5;
} else if (k > 8 && k < 12){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Lewis: " << iLewisHealth << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe shuffled closer!" << endl;
Sleep(500);
iJoeAttack += 5;
} else if (k > 8){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Lewis: " << iLewisHealth << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe laughed annoyingly!" << endl;
Sleep(500);
EnemyHP += 10;
}
}
if (EnemyHP < 20 && EnemyHP > 0 && e < 2){
cout << "Joe remembered World of Warcraft!" << endl;
Sleep(750);
EnemyHP = EnemyHP + 25;
++ e;
}
if ((UserHP >= 2 * EnemyHP) && m < 1)
{
EnemyHP = EnemyHP + (UserHP / 4);
++ m;
}
system("cls");
if (EnemyHP < 1 && v != 2)
{
cout << "...:::!!!You WIN!!!:::..." << endl;
return 0;
} else if (iLewisHealth < 1 && v != 1)
{
cout << "Lewis has been latched onto and recruited by the General!" << endl;
Sleep(1000);
EnemyHP += 10;
return 0;
}
}while (apples = true);
return 0;
}
int main ()
{
//You vs Joe
cin >> iPlayersName;
int iLewis;
do {
//Information
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Joe Weller: " << EnemyHP << endl;
//Users input
char l;
cin >> l;
//Proccess the input...
switch (l)
{
case 'a':
case 'A':
cout << "You attack!" << endl;
Sleep(500);
EnemyHP = EnemyHP - iDamage;
break;
case 'r':
case 'R':
if (iLifeUp < 6)
{
cout << "Used recover!" << endl;
Sleep(500);
UserHP = UserHP + 30;
++iLifeUp;
}
break;
case 's':
case 'S':
if (NoLewis < 1)
{
cout << "Use Lewis!!" << endl;
Sleep(500);
++NoLewis;
iLewis = Lewis();
}
break;
case 'l':
case 'L':
cout << "!OMG SEECRIT POWUR!" << endl;
Sleep(250);
do {
EnemyHP -= 20;
cout << "!OMG SEECRIT POWUR!" << endl;
cout << "Joe Weller: " << EnemyHP << endl;
system("cls");
}while (EnemyHP > -100);
break;
default:
cout << "Invalid move!" << endl;
Sleep(500);
}
//Joe's turn
if (EnemyHP > 0)
{
int k = rand() % 16;
if (k < 4){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe Weller used latch!" << endl;
Sleep(500);
UserHP -= iJoeAttack;
} else if (k > 4 && k < 8){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe made a bad joke!" << endl;
Sleep(500);
UserHP -= 5;
EnemyHP += 5;
} else if (k > 8 && k < 12){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe shuffled closer!" << endl;
Sleep(500);
iJoeAttack += 5;
} else if (k > 8){
system("cls");
cout << "a = attack, r = recover(" << iLifeUp << "/6), s = Lewis(" << NoLewis << "/1)" << endl;
cout << "You: " << UserHP << " " << "Joe Weller: " << EnemyHP << endl;
cout << "Joe laughed annoyingly!" << endl;
Sleep(500);
EnemyHP += 10;
}
}
//Joe recovers 25 + the value of his already existing health
//if his health is below 20 and above 0, this may only happen
//twice.
if (EnemyHP < 20 && EnemyHP > 0 && e < 2){
cout << "Joe remembered World of Warcraft!" << endl;
Sleep(750);
EnemyHP = EnemyHP + 25;
++ e;
}
if ((UserHP >= 2 * EnemyHP) && m < 1)
{
EnemyHP = EnemyHP + (UserHP / 4);
++ m;
}
system("cls");
//If Joe's HP is below 0 and yours isn't, move onto the Generals monologue.
if (EnemyHP < 1 && v != 2)
{
cout << "...:::!!!You WIN!!!:::..." << endl;
v = 1;
iGeneral = General();
return 0;
// If your HP is below 0 and Joe's isn't, end the game.
} else if (UserHP < 1 && v != 1)
{
cout << "...Joe has latched onto you, game over..." << endl;
v = 2;
return 0;
}
}while (apples = true);
}
Just C+P it, or maybe I'll upload the file. We'll see.
Last edited by Fear; May 31, 2011 at 01:47 AM.