Its a turret vs turret game with rounds . . . How many rounds will you least?
Hope you like it
Code:
#include <iostream>
#include <windows.h>
#include <ctime>
using namespace std;
int scorex = 0;
int multi2;
int hpp2 = 200;
int multi;
int vida2 = 1;
int gold = 100;
int vida1 = 1;
void score(){
cout << "You Survived " << scorex << " Rounds " << endl;
cin.get();
exit(1);
}
void gamepart1(){
time_t t;
time(&t);
srand(t);
char nopelea = 'n';
do{
multi2++;
multi = 3 + 1;
++multi;
vida1 = vida1 + 300 + 400;
hpp2 = hpp2 + 250;
vida2 = hpp2 + 400 + 400;
char upgrade;
cout << " Turret Board / Stats " << endl;
cout << " Turret Heatlh -> " << vida1 << endl;
cout << " Turret Money -> " << gold << endl;
cout << " Want to Upgrade Turret Health ? ( 210 Gold ) ( y / n )" << endl;
cin >> upgrade;
if (upgrade == 'y'){
if (gold>210){
cout << " Health Upgraded ! " << endl;
vida1 = vida1 + 150;
gold = gold - 310;
}else {
cout << " Need More Gold ! " << endl;
}
}
cout << " Want to Start Battle ? ( y / n )" << endl;
cin >> nopelea;
}while(nopelea == 'n');
do{
if (multi>1){
int dmg = rand() % 44 * multi;
int dmg2 = rand() % 26 * multi2;
cout << " Your Turret " << " " << " Enemy Turret " << endl;
cout << " Health ->" << vida1 << " " << " Health ->" << vida2 << endl;
cout << " You Deal " << dmg << " " << " Enemy Deal " << dmg2 << endl;
vida1 = vida1 - dmg2;
vida2 = vida2 - dmg;
cout << "Press Any Key to Continue Attacking" << endl;
cin.get();
if (vida1<0){
cout << " You Lose GameOver Press any key to continue . . . " << endl;
score ();
}else if (vida2<0){
cout << " You Win The Battle " << endl;
gold = gold + 105;
gamepart1 ();
}
}
}while(nopelea == 'y');
}
int main(){
cout << "------------------------------" << endl;
cout << "| Welcome to Turret Champion |" << endl;
cout << "------------------------------" << endl;
gamepart1 ();
}
I know code is little messy but It was a very old project so decide to release it and edit some things . . . maybe someone found it usefull