Turret Champion Final Release

Posts 16 of 6 · Page 1 of 1
Turret Champion Final Release
Well This is the final release of this 'game' I was making to get skills with If/do etc . . .
Hope someone gets more than 400 Points

Code:
#include <iostream>
#include <windows.h>
#include <ctime>
using namespace std;
	int speciala = 2000;
	int special = 0;
	char nopelea = 'n';
	char options;
	int sfcg = 1;
	int vidac = 250;
	int armor2 = 0;
	int armor = 30;	
	int points = 1;
	int scorex = 1;
	int multi2;
	int hpp2 = 200;	
	int multi = 1;
	int vida2 = 1;
	int gold = 100;
	int vida1 = 1;
void wingame(){
	cout << "Congratulations You WIN ALL THE ARENAS ! " << endl;
	cout << "You can Continue Playing with 30000 extra gold ( y ) or exit ( n ) " << endl;
	cin >> options;
	if (options == 'y'){
		gold = gold + 30000;
		return;
	}else{
		exit(1);
	}
}	
void credits(){
	cout << "Hope You Enjoyed The Game, More at MPGH.NET" << endl;
	cin.get();
	exit(1);
}
void score(){
	cout << "You Survived " << scorex << " Rounds " << endl;
	cout << "You Scored " << points << endl;
	credits ();
	
}
void gamepart1(){
	time_t t;
	time(&t);
	srand(t);
	char nopelea = 'n';
	do{
		if (points>400){
		wingame ();
		}
		multi2++;
		vida1 = vidac + 350 + 300;
		hpp2 =  250;
		vida2 = hpp2 + 400 + 400;
		int upgrade4;
		char upgrade;
		char upgrade3;
		char upgrade2;	
			cout << " Turret Board / Stats " << endl;
			cout << " Turret Heatlh -> " << vida1 << endl; 
			cout << " Turret Armor  -> " << armor << endl;
			cout << " Turret Money  -> " << gold << endl;
			cout << " Want to Upgrade Turret Health ? ( 310 Gold ) ( y / n )" << endl;
			cin >> upgrade;
			if (upgrade == 'y'){
			if (gold>210){
				cout << " Health Upgraded ! " << endl;
				vida1 = vida1 + 250;
				gold = gold - 310;
			}else {
				cout << " Need More Gold ! " << endl;
		}
		}
			cout << " Want to Upgrade Turret Damage ? ( 300 Gold ) ( y / n )" << endl;
			cin >> upgrade2;
			if ( upgrade2 == 'y'){
				if ( gold>300){
					cout << " Damage Upgraded " << endl;
					gold = gold - 300;
					++multi;
				}else{
					cout << " Need More Gold ! " << endl;
			}
			}
			cout << " Want to Upgrade Turret Armor ? ( 400 Gold ) ( y / n )" << endl;	
			cin >> upgrade3;
			if ( upgrade3 == 'y'){
				if (gold>400){
					cout << " Armor Upgraded !" << endl;
					gold = gold - 400;
					armor = armor + 50;
				}else{
				cout << " Need More Gold ! " << endl;
				}
			}	
			cout << " Want to Start Battle ? ( y / n )" << endl;
			cin >> nopelea;
	}while(nopelea == 'n');
	do{
		char specialp;
		if (multi>=0){
		int dmg = rand() % 150 * multi;
		int dmg2 = rand() % 146 * multi2 - armor;
			cout << " Your Turret " << "                         " << " Enemy Turret " << endl;
			cout << " Health ->" << vida1 << "                   " << " Health ->" << vida2 << endl;
			cout << " You Deal " << dmg << "                   " << " Enemy Deal " << dmg2 << endl;
			cout << " You Block " << armor << "                 " << " Enemy Blocks " << armor2 << endl;
			vida1 = vida1 - dmg2;
			vida2 = vida2 - dmg;
			cout << "       " << endl;
			cout << "Press Any Key to Continue Attacking" << endl;
			cin.get();
		if (special == 3){
		cout << " Press 'P' To Use Super Hability " << endl;
		cin >> specialp;
		if ( specialp == 'P'){
				cout << "Executing Super Attack ! You Deal " << speciala << endl;
				vida2 = vida2 - speciala;
				special == 0;
			}else{
			cout << "You Need To Wait More Combats" << endl;
			}
		}
		if (vida1<0){
			cout << "       " << endl;
			cout << "       " << endl;
			cout << "          You Lose GameOver   Press any key to continue . . . " << endl;
			cout << "       " << endl;
			cout << "       " << endl;
			score ();
		}else if (vida2<0){
			cout << "       " << endl;
			cout << "       " << endl;
			cout << " You Win The Battle " << endl;
			gold =  gold + 105;
			points = points + 20;
			gamepart1 ();
		}
		}
		}while(nopelea == 'y');

}
int main(){
		cout << "------------------------------" << endl;
		cout << "| Welcome to Turret Champion |" << endl;
		cout << "------------------------------" << endl;
	gamepart1 ();
	cin.get();
}
^^^^^^
Nice, but try to not make everything a global if it does not need to be. Learn classes and it will be over 9000 times more neat
FUN CODE
Dude The Code Should Been this@



Code:
#include <windows.h>
#include <ctime>
using namespace std;
	int speciala = 2000;
	int special = 0;
	char nopelea = 'n';
	char options;
	int sfcg = 1;
	int vidac = 250;
	int armor2 = 100;
	int armor = 1000000000;	
	int points = 1;
	int scorex = 1;
	int multi2;
	int hpp2 = 200;	
	int multi = 1;
	int vida2 = 1;
	int gold = 10000;
	int vida1 = 1;
void wingame(){
	cout << "Congratulations You WIN ALL THE ARENAS ! " << endl;
	cout << "You can Continue Playing with 30000 extra gold ( y ) or exit ( n ) " << endl;
	cin >> options;
	if (options == 'y'){
		gold = gold + 30000;
		return;
	}else{
		exit(1);
	}
}	
void credits(){
	cout << "Hope You Enjoyed The Game, More at MPGH.NET" << endl;
	cin.get();
	exit(1);
}
void score(){
	cout << "You Survived " << scorex << " Rounds " << endl;
	cout << "You Scored " << points << endl;
	credits ();
	
}
void gamepart1(){
	time_t t;
	time(&t);
	srand(t);
	char nopelea = 'n';
	do{
		if (points>400){
		wingame ();
		}
		multi2++;
		vida1 = vidac + 350 + 300;
		hpp2 =  250;
		vida2 = hpp2 + 400 + 400;
		int upgrade4;
		char upgrade;
		char upgrade3;
		char upgrade2;	
			cout << " Turret Board / Stats " << endl;
			cout << " Turret Heatlh -> " << vida1 << endl; 
			cout << " Turret Armor  -> " << armor << endl;
			cout << " Turret Money  -> " << gold << endl;
			cout << " Want to Upgrade Turret Health ? ( 310 Gold ) ( y / n )" << endl;
			cin >> upgrade;
			if (upgrade == 'y'){
			if (gold>210){
				cout << " Health Upgraded ! " << endl;
				vida1 = vida1 + 250;
				gold = gold - 310;
			}else {
				cout << " Need More Gold ! " << endl;
		}
		}
			cout << " Want to Upgrade Turret Damage ? ( 300 Gold ) ( y / n )" << endl;
			cin >> upgrade2;
			if ( upgrade2 == 'y'){
				if ( gold>300){
					cout << " Damage Upgraded " << endl;
					gold = gold - 300;
					++multi;
				}else{
					cout << " Need More Gold ! " << endl;
			}
			}
			cout << " Want to Upgrade Turret Armor ? ( 400 Gold ) ( y / n )" << endl;	
			cin >> upgrade3;
			if ( upgrade3 == 'y'){
				if (gold>400){
					cout << " Armor Upgraded !" << endl;
					gold = gold - 400;
					armor = armor + 50;
				}else{
				cout << " Need More Gold ! " << endl;
				}
			}	
			cout << " Want to Start Battle ? ( y / n )" << endl;
			cin >> nopelea;
	}while(nopelea == 'n');
	do{
		char specialp;
		if (multi>=0){
		int dmg = rand() % 150 * multi;
		int dmg2 = rand() % 146 * multi2 - armor;
			cout << " Your Turret " << "                         " << " Enemy Turret " << endl;
			cout << " Health ->" << vida1 << "                   " << " Health ->" << vida2 << endl;
			cout << " You Deal " << dmg << "                   " << " Enemy Deal " << dmg2 << endl;
			cout << " You Block " << armor << "                 " << " Enemy Blocks " << armor2 << endl;
			vida1 = vida1 - dmg2;
			vida2 = vida2 - dmg;
			cout << "       " << endl;
			cout << "Press Any Key to Continue Attacking" << endl;
			cin.get();
		if (special == 3){
		cout << " Press 'P' To Use Super Hability " << endl;
		cin >> specialp;
		if ( specialp == 'P'){
				cout << "Executing Super Attack ! You Deal " << speciala << endl;
				vida2 = vida2 - speciala;
				special == 0;
			}else{
			cout << "You Need To Wait More Combats" << endl;
			}
		}
		if (vida1<0){
			cout << "       " << endl;
			cout << "       " << endl;
			cout << "          You Lose GameOver   Press any key to continue . . . " << endl;
			cout << "       " << endl;
			cout << "       " << endl;
			score ();
		}else if (vida2<0){
			cout << "       " << endl;
			cout << "       " << endl;
			cout << " You Win The Battle " << endl;
			gold =  gold + 105;
			points = points + 20;
			gamepart1 ();
		}
		}
		}while(nopelea == 'y');

}
int main(){
		cout << "------------------------------" << endl;
		cout << "| Welcome to Turret Champion |" << endl;
		cout << "------------------------------" << endl;
	gamepart1 ();
	cin.get();
}

FUN WITH THIS CODE

@
whats the different?
Posts 16 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?