Thursday 18 June 2009

Break time

Alright, now I'm taking a break from stuffing info in my brain and have decided to try out a few things I've learned so far. I'm creating a minigame. I say game because it has a plot, upgradeable variables (like health, powers) and stuff. But I say mini because, so far, it has no graphics, no enemies, and i'm still trying to come up with problems for the protagonist to overcome. Oh what the heck, I'll just present the code and let you see what it looks like so far. Note: I only started doing it last night. I'm writing this the next morning. Oh and no laughing, I'm still learning here.

#include
#include
#include

using namespace std;

int main()
{

cout << "Twenty seven centuries ago, an upper-level demon known to few as Klarius"<< endl;
cout << "stumbled on a fallen angel, raped her and left her for dead. She survived and"<< endl;
cout << "was pregnant. Ten years later, she gave birth to an omen. A creature with"<< endl;
cout << " the might of heaven and hell and a powerful thirst for the souls of men." << endl;
cout << "His name was called.....'Naftali'.\n";

int Powers(100);
string identity;

identity = "\nName: Naftali Warren\n";

cout << identity << endl;
cout << "\nPowers: " << Powers << endl;//Naftali's overall game health

vector souls;
vector::iterator profile;
profile = souls.begin();

souls.push_back("1. James Craddock");
souls.push_back("2. Rebecca Romain");
souls.push_back("3. Michelle Rooney");
souls.push_back("4. Sally Gavin");
souls.push_back("5. Ezeikel DePrain");
souls.push_back("6. Phil Senton");
souls.push_back("7. Ryan Gates");
souls.push_back("8. Elizabeth Wank");

cout << "\nYou currently possess " << souls.size() << " souls.\n";

cout << "\nSouls possessed:\n" << endl;

for (int i = 0; i < souls.size(); ++i)
cout << souls[i] << endl;

string change, activity;
string answer;


cout << "\nPick an activity\n";
cin >> activity;

int transform = 0;


while
(activity == "change")
{cout << "Enter a number to assume the identity of a soul\n";
cin >> answer;

if (answer == "1")
identity = souls[0];//Reassign 'Naftali's' identity to one of vectors shown

if (answer == "2")
identity = souls[1];

if (answer == "3")
identity = souls[2];

if (answer == "4")
identity = souls[3];

if (answer == "5")
identity = souls[4];

if (answer == "6")
identity = souls[5];

if (answer == "7")
identity = souls[6];

if (answer == "8")
identity = souls[7];

while (answer != "1"&& answer !="2"&&answer !="3"&&answer !="4"&&answer !="5"&&
answer !="6"&&answer !="7"&&answer !="8")
{cout << "Sorry, incorrect entry. Please try again" << endl;
cin >> answer;}

cout << "++++++++++++++++++++++++++++++++++++++++++" << endl;
cout << "You have now transformed into soul number " << identity << endl;
++transform;
Powers -= 15;
cout << "\nThis is your transformation number " << transform << endl;
cout << "\nPower level: " << Powers << endl;
cout << "++++++++++++++++++++++++++++++++++++++++++" << endl;
cout << "\nPick an activity\n";
cin >> activity;
if (Powers <= 0 && activity == "change")
cout << "Your power levels are too low to make any more transformations" << endl;
cout << "Pick an activity" << endl;
}

while (activity == "meditate")
{
if (Powers < 100)
Powers += 10;
cout << "You have spawned back 10 points of your powers and now have " << Powers << " points" << endl;
cout << "Pick an activity" << endl;
cin >> activity;

}
if (Powers >= 100)
{
cout << "Your power levels are at their fullest and cannot be spawned any further" << endl;
cout << "Pick an activity" << endl;
cin >> activity;
}

system("PAUSE");
return 0;
}

Game Summary: Its basically about a half-angel, half-demon with the power of heaven and hell who can devour souls and assume their identities and talents. He can also heal from just about any injury and has all other kinds of cool abilities. I'm just working out what obstacles he has to overcome.

About a bajillion bugs are in this code, but debugging it is what is teaching me new things and reminding me all that I've learned so far so I don't forget. And next time, I think I'll stick to a plan. This code keeps evolving and developing a mind of it's own.