Looking for pointers on my game
Dec 2, 2013 at 6:39am UTC
I just wrote this in the last hour, I have been plying with C++ Java and a few other languages for a long time, but I never took an official class or anything. I wish I had a class available to me in my area, I would love to take one. Y'see, everything I've learned has been from youtube videos, and I fret that I may be missing some huge technique!
This is a pretty good example of my programming skills, feel free to play it a little. :D
GLITCH FIX: Your name has to be one lowercase letter. I forgot how to make a char hold multiple characters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
//MOB stats!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
int hp = 100;
int mp = 50;
int att = 10;
int aihp;
int aimp;
int aiatt;
//Player stats~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//MOB gear!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
int helm = 0;
int chest = 0;
int legs = 0;
int aihelm = 0;
int aichest = 0;
int ailegs = 0;
//MOB gear~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Battle Ints!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
int turn = 0;
int luck = 0;
int rank = 0;
//Battle Ints~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Game Startup!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
int route = 0;
int choice = 0;
int lvl = 1;
char name;
cout << "Hello, welcome to the World, of, Jake!!! (Que the music!)" << endl;
system ("pause" );
system ("cls" );
cout << "Just kidding..." << endl;
cout << "we have no music :(" << endl;
cout << "Game launch!" << endl;
system ("pause" );
system ("cls" );
cout << "What shall we call you?" << endl;
cin >> name;
cout << "That's too long, I will call you " << name << "." << endl;
system ("pause" );
system ("cls" );
cout << "What kind of character do you wish to play?" << endl << endl << "[1] Warrior" << endl << "[2] Archer" << endl << "[3] Mage" << endl;
while (route == 0)
{//CHOICE CODE STARTS HERE
cin >> route;
if (route == 1) //Warrior Default stats
{
hp = 200 * lvl;
mp = 0 * lvl;
att = 15 * lvl;
}
else if (route == 2)//Archer Default stats
{
hp = 100 * lvl;
mp = 50 * lvl;
att = 30 * lvl;
}
else if (route == 3)//Mage default stats
{
hp = 75 * lvl;
mp = 200 * lvl;
att = 15 * lvl;
}
else
{
cout << endl << "You must pick a class." << endl;
system ("pause" );
}
}
cout << "Your Health: " << hp << endl << "Your Mana: " << mp << endl << "Your ATT: " << att << endl << endl;
system ("pause" );
system ("cls" );
cout << "Welcome " << name << " to the world of Jake." << endl;
system ("pause" );
system ("cls" );
//Game Startup~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//Main Game!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
while (true )
{//!!!!!!!!!!!!!Game code starts here.
cout << "What would you like to do?" << endl << endl << "[1] Go to Jake Arena!" << endl << "[2] Quit Game!" << endl;
cin >> choice;
if (choice == 1)//Fight code starts here
{
cout << "Welcome to the first trial... MUAHAHAHA!! :@" << endl;
system ("PAUSE" );
system ("cls" );
aihp = 300;
aimp = 1000;
aiatt = 5;
while (choice == 1)//Fight starts here
{
cout << "You Attack!" << endl << endl;
system ("pause" );
system ("cls" );
hp = hp - aiatt;
aihp = aihp - att;
cout << "Your health: " << hp << endl << "Your enemies health: " << aihp << endl;;
system ("pause" );
system ("cls" );
if (hp <= 0)
{
return 0;
}
else if (aihp <= 0)
{
cout << "You win!" << endl;
system ("pause" );
system ("cls" );
choice = 0;
}
else
{
cout << "The battle continues..." << endl;
}
}
}
else if (choice == 2)
{
return 0;
}
else
{
cout << "Not valid" << endl;
}
system ("pause" );
system ("cls" );
}//~Game code ends here
//Main Game~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
system("PAUSE" );
return 0;
}
Also, as a sidenote this was compiled in Dev C++
Last edited on Dec 2, 2013 at 6:42am UTC
Topic archived. No new replies allowed.