Ok, i've been into C++ for a while now and still only know very little, at the moment i am working on a C++ RPG to help me boost my C++ skills in large amounts of code, i don't know if its any good yet, so i want you to decide and also to point out in ways i can improve...
Here's the code:
(Only the main.exe as the other bit is pointless which leads on to this...)
// Game Created by Cetrix
// Please don't take my code and not give me credit...
// Its not nice and just proves you can't do it yourself...
// Thank You.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int money = 0;
int lvl = 5;
int health = 140;
int first = 0;
int choice;
int damage = 10;
int creature1;
int wolf_hp = 4;
int bear_hp = 8;
int goblin_hp = 10;
int chicken_hp = 1;
int damage2;
int r;
int wolf_def = 1;
int bear_def = 1;
int goblin_def = 1.5;
int killed = 0;
int ha_lvl = 10;
int ha_damage = 27;
int ha_hp = 170;
int kill_lvl = 6;
int kill_damage = 10;
int kill_hp = 120;
int glad_lvl = 6;
int glad_damage = 12;
int glad_hp = 140;
int juicer_lvl = 8;
int juicer_damage = 15;
int juicer_hp = 200;
int arena = 0;
srand((unsigned)time(0));
for(int index=0; index<1; index++){
r = (rand()%4)+0;
}
win:
creature1 = r;
cout<<"\n\n";
cout<<"Along the road you come across a: ";
_sleep(2000);
if (creature1 == 0) {
cout<<" WOLF!";
wolf:
cout<<"\n WOLF has "<<wolf_hp<<" Health!";
cout<<"\nIt attacks you and does: ";
damage2 = rand()%14;
cout<< damage2 <<" damage!";
_sleep(2000);
health = health - damage2;
cout<<"\nYou have "<< health <<" health!";
if ( health <=0 ) {
cout<<" You are deaded!!\n";
}
else {
damage = damage / wolf_def;
wolf_hp = wolf_hp - damage;
cout<<"\nYou do: "<<damage<<" damage! WOLF has: "<<wolf_hp<<" health left!";
} if (wolf_hp <= 0) {
cout<<"\n\n WOLF is deaded!\n";
}
else {
goto wolf;
}
}
if (creature1 == 1) {
cout<<" BEAR!";
bear:
cout<<"\n BEAR has "<<bear_hp<<" Health!";
cout<<"\nIt attacks you and does: ";
damage2 = rand()%20;
cout<< damage2 <<" damage!";
_sleep(2000);
health = health - damage2;
cout<<"\nYou have "<< health <<" health!";
if ( health <=0 ) {
cout<<" You are deaded!!\n";
}
else {
damage = damage / bear_def;
bear_hp = bear_hp - damage;
cout<<"\nYou do: "<<damage<<" damage! BEAR has: "<<bear_hp<<" health left!";
} if (bear_hp <= 0) {
cout<<"\n\n BEAR is deaded!\n";
}
else {
goto bear;
}
}
if (creature1 == 2) {
cout<<" GOBLIN!";
goblin:
cout<<"\n GOBLIN has "<<goblin_hp<<" Health!";
cout<<"\nIt attacks you and does: ";
damage2 = rand()%40;
cout<< damage2 <<" damage!";
_sleep(2000);
health = health - damage2;
cout<<"\nYou have "<< health <<" health!";
if ( health <=0 ) {
cout<<" You are deaded!!\n";
}
else {
damage = damage / goblin_def;
goblin_hp = goblin_hp - damage;
cout<<"\nYou do: "<<damage<<" damage! GOBLIN has: "<<goblin_hp<<" health left!";
} if (goblin_hp <= 0) {
cout<<"\n\n GOBLIN is deaded!\n";
}
else {
goto goblin;
}
}
if (creature1 == 3) {
cout<<" CHICKEN!";
chicken:
cout<<"\n CHICKEN has "<<chicken_hp<<" Health!";
cout<<"\nIt attacks you and does: ";
damage2 = rand()%150;
cout<< damage2 <<" damage!";
_sleep(2000);
health = health - damage2;
cout<<"\nYou have "<< health <<" health!";
if ( health <=0 ) {
cout<<" You are deaded!!\n";
exit(0);
}
else {
damage = damage;
chicken_hp = chicken_hp - damage;
cout<<"\nYou do: "<<damage<<" damage! Chick has: "<<chicken_hp<<" health left!";
} if (chicken_hp <= 0) {
cout<<"\n\n CHICKEN is deaded!\n";
}
else {
goto chicken;
}
}
cout<<"==================================================================\n";
cout<<"\n\n Congrats! You killed it!!";
killed = killed + 1;
lvl = lvl + 1;
health = health + 10;
money = money + 100;
cout<<"\nYou are now lvl: "<< lvl <<" with "<< health <<" health! You also gained: "<<money<<" silvers!";
_sleep(1000);
cout<<"\n\nAfter cleaning your blades, you look up!!";
cout<<"\nWithout realising you have made it it 'Ashrock'!";
goto ashrock;
ashrock:
int choice2;
cout<<"\n\n";
cout<<"==================================================================\n\n";
cout<<"Welcome to Ashrock! Where are you going?";
cout<<"\n\n";
cout<<"1. Red Moon Inn.\n";
cout<<"2. Training.\n";
cout<<"3. Dueling Arena.\n";
cout<<"4. Leave Ashrock.\n";
cout<<"::: ";
cin>> choice2;
cout<<"\n==================================================================\n\n";
if (choice2 == 1) {goto rm_inn;}
if (choice2 == 2) {goto train_ashrock;}
if (choice2 == 3) {goto arena_ashrock;}
if (choice2 == 4) {goto leave_ashrock;}
rm_inn:
int choice_inn_ashrock;
cout<<"\n\n";
cout<<"==================================================================\n";
cout<<"Welcome to Red Moon Inn!";
cout<<"\nWhat do you want to do?";
cout<<"\n1. Get a room (5 silvers)";
cout<<"\n2. Leave";
cout<<"\n ::: ";
cin>> choice_inn_ashrock;
cout<<"\n==================================================================\n\n";
if (choice_inn_ashrock == 1) {
if (money <=0) {
cout<<"You can't afford it! Get out!";
goto ashrock;
}
else {
cout<<"\n\n";
cout<<"==================================================================\n";
cout<<"You get a room and rest...";
health = health + 3;
money = money - 5;
cout<<"You now have: "<< health <<" health! and "<<money<<" silvers!";
cout<<"\n==================================================================\n\n";
goto rm_inn;
}
}
if (choice_inn_ashrock == 2) {goto ashrock;}
train_ashrock:
int train_choice;
cout<<"\n\n";
cout<<"==================================================================\n";
cout<<"Welcome to Training!\n";
cout<<"\nWhat do you want to do?";
cout<<"\n1. Train.";
cout<<"\n2. Leave.";
cout<<"\n ::: ";
cin>> train_choice;
cout<<"\n==================================================================\n\n";
if (train_choice == 1) {
if (lvl >= 10) {
cout<<"==================================================================\n";
cout<<"Sorry, you are too high to train here!\n";
cout<<" You should try the arena!\n";
cout<<"==================================================================\n\n";
goto ashrock;
}
if (lvl <= 9) {
cout<<"\n\n";
cout<<"==================================================================\n";
cout<<"You train hard!";
lvl = lvl + 1;
health = health + 10;
cout<<"\n You are level: "<<lvl<<" with "<<health<<" health!\n";
cout<<"==================================================================\n\n";
goto train_ashrock;
}
}
if (train_choice == 2) {
cout<<"\n\n==================================================================\n";
cout<<"You leave the training area!\n";
cout<<"==================================================================\n\n";
goto ashrock;
}
arena_ashrock:
int arena_ashrock_choice;
int opponent;
srand((unsigned)time(0));
for(int index=0; index<1; index++){
opponent = (rand()%4)+0;
}
cout<<"\n\n";
cout<<"==================================================================\n";
cout<<"Welcome to Arena!";
cout<<"\nWhat do you want to do?";
cout<<"\n1. Fight a duel (TO THE DEATH)";
cout<<"\n2. Leave.";
cout<<"\n ::: ";
cin>> arena_ashrock_choice;
cout<<"\n==================================================================\n\n";
if (arena_ashrock_choice == 1) {
if (arena == 1) {
cout<<"As you've won a duel you cannot duel again...";
goto ashrock;
}
else {
cout<<"\n\n";
damage = (lvl * lvl) / 3;
cout<<"==================================================================\n";
if (opponent == 0) {
cout<<"You will be fighting: The Killer!\n";
cout<<"He's Lvl: "<<kill_lvl<<" and does: "<<kill_damage<<" damage each hit!\n";
cout<<"You enter the Arena!\n";
fight1:
if (kill_hp <=0 ) {
cout<<"\nOpponent is dead!\n";
lvl = lvl + 1;
health = health + 10;
cout<<"\nYou lvled up to: "<<lvl<<"!";
cout<<"\nHere's your prize money: 1000 silvers\n";
money = money + 1000;
cout<<"You now have: "<<money<<" silvers!\n\n";
cout<<"\n==================================================================\n\n";
arena = arena + 1;
goto arena_ashrock;
}
else {
cout<<"\n Opponent Attacks!\n";
health = health - kill_damage;
cout<<"\nHealth Left: "<<health;
if (health <=0 )
{cout<<"\nYou are deaded!\n";
cin.get();
exit(0);
}
_sleep(2000);
cout<<"\nYou attack!\n";
kill_hp = kill_hp - damage;
cout<<"\nOpponent Health: "<<kill_hp;
_sleep(2000);
goto fight1;
}
}
if (opponent == 1) {
cout<<"You will be fighting: The Gladiator!\n";
cout<<"He's Lvl: "<<glad_lvl<<" and does: "<<glad_damage<<" damage each hit!\n";
cout<<"You enter the Arena!\n";
fight2:
if (glad_hp <=0 ) {
cout<<"\nOpponent is dead!\n";
lvl = lvl + 1;
health = health + 10;
cout<<"\nYou lvled up to: "<<lvl<<"!";
cout<<"\nHere's your prize money: 1000 silvers\n";
money = money + 1000;
cout<<"You now have: "<<money<<" silvers!\n\n";
cout<<"\n==================================================================\n\n";
arena = arena + 1;
goto arena_ashrock;
}
else {
cout<<"\n Opponent Attacks!\n";
health = health - glad_damage;
cout<<"\nHealth Left: "<<health;
if (health <=0 )
{cout<<"\nYou are deaded!\n";
cin.get();
exit(0);
}
_sleep(2000);
cout<<"\nYou attack!\n";
glad_hp = glad_hp - damage;
cout<<"\nOpponent Health: "<<glad_hp;
_sleep(2000);
goto fight2;
}
}
if (opponent == 2) {
cout<<"You will be fighting: The Juicer!\n";
cout<<"He's Lvl: "<<juicer_lvl<<" and does: "<<juicer_damage<<" damage each hit!\n";
cout<<"You enter the Arena!\n";
fight3:
if (juicer_hp <=0 ) {
cout<<"\nOpponent is dead!\n";
lvl = lvl + 1;
health = health + 10;
cout<<"\nYou lvled up to: "<<lvl<<"!";
cout<<"\nHere's your prize money: 1000 silvers\n";
money = money + 1000;
cout<<"You now have: "<<money<<" silvers!\n\n";
cout<<"\n==================================================================\n\n";
arena = arena + 1;
goto arena_ashrock;
}
else {
cout<<"\n Opponent Attacks!\n";
health = health - juicer_damage;
cout<<"\nHealth Left: "<<health;
if (health <=0 )
{cout<<"\nYou are deaded!\n";
cin.get();
exit(0);
}
_sleep(2000);
cout<<"\nYou attack!\n";
juicer_hp = juicer_hp - damage;
cout<<"\nOpponent Health: "<<juicer_hp;
_sleep(2000);
goto fight3;
}
}
if (opponent == 3) {
cout<<"You will be fighting: Ha## Tur####!\n";
cout<<"He's Lvl: "<<ha_lvl<<" and does: "<<ha_damage<<" damage each hit!\n";
cout<<"Unlucky, you may not return alive...\n";
cout<<"\nYou enter the Arena!";
fight4:
if (ha_hp <=0 ) {
cout<<"\nOpponent is dead!\n";
lvl = lvl + 1;
health = health + 10;
cout<<"\nYou lvled up to: "<<lvl<<"!";
cout<<"\nHere's your prize money: 1000 silvers\n";
money = money + 1000;
cout<<"You now have: "<<money<<" silvers!\n\n";
cout<<"\n==================================================================\n\n";
arena = arena + 1;
goto arena_ashrock;
}
else {
cout<<"\n Opponent Attacks!\n";
health = health - ha_damage;
cout<<"\nHealth Left: "<<health;
if (health <=0 )
{cout<<"\nYou are deaded!\n";
cin.get();
exit(0);
}
_sleep(2000);
cout<<"\nYou attack!\n";
ha_hp = ha_hp - damage;
cout<<"\nOpponent Health: "<<ha_hp;
_sleep(2000);
goto fight4;
}
}
}
if (arena_ashrock_choice == 2) {
goto ashrock;
}
}
leave_ashrock:
int leave;
cout<<"\n\n";
cout<<"==================================================================\n";
cout<<"You leave Ashrock!\n";
cout<<"\nWhere are you going?";
cout<<"\n1. Ashmere.";
cout<<"\n2. Haves.";
cout<<"\n ::: ";
cin>> leave;
if (leave == 1) {
if (lvl >= 10) {
cout<<"==================================================================\n";
cout<<"\n\nFarwell, Friend!";
goto ashrock;
}
else {
cout<<"==================================================================\n";
cout<<"\n\nYou are too low to go there! Please stay and train!";
goto ashrock;
}
}
cin.get();
}
Like i said any help would be highly appreciated and i am still very much a begginer...
Also a D/L link:
http://sharemino.com/file/254/TheExiled-rar.htmlAnd i would appreciate it if someone could tell me how to get the installer to make a shortcut and everything, cos at the moment it only puts the files in directory. Also How do i change the .exe's icon?
(Sorry im asking for soo much help but i need it =D)