Code:
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cctype> // files used
#include <windows.h>
#include <algorithm>
#include <conio.h>
using namespace std; // for cout and endl;
void intro();
void level1();
void plea();
void wizavillage();
void signpost();
void endingANDcredits();
extern void gameover();
/* Player Varibles*/
string pname; // player name
int health = 100; // player health;
int MAXhealth = 500; // player maximum health
int MINhealth = 1; // player minimum health
int gold = 0; // gold player has gathered
int Exp = 0; // experience gained
int spells = 0; // number of magic spells learned
string spellname; // string fof spell name
int level = 1; // player level
/* Enemy Varibles*/
string enemyname; // string for enemy name
int ehealth; // enemy health
int edamage; // enemy damage
int elevel; // enemy level;
bool edead; // booleen varible to decide is enemy defeated or active
bool ealive; // ""
/* Misc Vsribles*/
int size;
int x; // special varibles used in text scroll
char attack; // used in battle
char choice; // used in selection
char magic; // used in magic
int main(int argc, char *argv[])
{
SetConsoleTitle("W I Z A D O R A - BY PETER WATTS -"); // console Title
intro();
level1();
plea();
wizavillage();
signpost();
endingANDcredits();
if(health<=0) gameover();
return 0;
} // end main
void intro()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
/*
* First save the current color information
*/
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
/*
* Set the new color information
*/
SetConsoleTextAttribute ( h, FOREGROUND_GREEN | FOREGROUND_INTENSITY );
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED| FOREGROUND_GREEN | FOREGROUND_INTENSITY );
cout << "\n\n";
cout <<"\t\t=============================================\n";
printf("\t\t# # # ##### #### #### #### #### ####\n"
"\t\t# # # # # # # # # # # # # #\n"
"\t\t# # # # # # # # # # #### # #\n"
"\t\t# # # # # #### # # # # # # ####\n"
"\t\t# # # # # # # # # # # # # # #\n"
"\t\t##### # ##### # # #### #### # # # #\n"
"\t\t=============================================\n"
"\t\t| | \n"
"\t\t| Press P to Play A New Game | \n"
"\t\t| | \n"
"\t\t| Press L to Load A Saved Game | \n"
"\t\t| | \n"
"\t\t| Press Q to Quit the Game | \n"
"\t\t--------------------------------------------- \n");
cout << "\n\n";
cout << "\tSelection >";
cin >> choice;
if (choice == 'l')
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
/*
* First save the current color information
*/
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
/*
* Set the new color information
*/
SetConsoleTextAttribute ( h, FOREGROUND_RED|FOREGROUND_INTENSITY );
system("cls");
printf("The load feature is not yet avalible...");
Sleep(2000);
system("cls");
intro();
}
else if (choice == 'q')
{
system("cls");
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
/*
* First save the current color information
*/
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
/*
* Set the new color information
*/
SetConsoleTextAttribute ( h, FOREGROUND_BLUE|FOREGROUND_INTENSITY );
printf("Goodbye then, please come back to save the kingdom soon...\n");
Sleep(3000);
exit(0);
}
else if (choice == 'p')
{
system("cls");
SetConsoleTextAttribute ( h, wOldColorAttrs);
cin.ignore();
level1();
}
else {
system("cls");
printf("You must enter one of the three commands!\n");
Sleep(2000);
system("cls");
intro();
}
} // end intro
void level1()
{
system("cls");
char senta[]="Hail adventurer!\nDo you seek glory, fame, fortune\nand even gold?\n"
"Then I welcome you to my land of magic and fantasy...\nI am Wizadora\n"
"and I need your help....\n";
size=strlen(senta);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",senta[x]);
}
Sleep(2000);
system("cls");
char sentb[]="But before you can start, I need to know your name.\nAs I cannot keep\n"
"calling you adventurer now can I?\n"
"\n\n"
"My name is: ";
size=strlen(sentb);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentb[x]);
}
getline ( cin, pname );
char sentc[]="\n\n"
"So, your name is ";
size=strlen(sentc);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentc[x]);
}
cout<<""<< pname <<""<<endl;
char sentd[]="Thats is a nice name!\nI hope we can get on well together...\n"
"Would you like to hear my story of why I have come to ask for your\n"
"aid ";
size=strlen(sentd);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentd[x]);
}
cout<<""<< pname <<"?"<<endl;
printf("\n\n"
"Press Y to hear her plea or N to continue anyway\n"
"\n\n");
cout << "Will you? ";
cin >> choice;
if (choice == 'n')
{
system("cls");
wizavillage();
}
else if (choice == 'y')
{
system("cls");
plea();
}
else {
printf("\n\n"
"You must enter yes or no...");
Sleep(2000);
level1(); // loop back to start of game to make sure question is aswered
}
} // end of level1
void plea()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
/*
* First save the current color information
*/
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
/*
* Set the new color information
*/
SetConsoleTextAttribute ( h, FOREGROUND_GREEN|FOREGROUND_INTENSITY );
system("cls");
char sentmp[]="The land of Wiza, which is basicly a land of child fantasy\n"
"has always been a peaceful land, where young trainee wizards\n"
"and witches roam, and practice their magic in the hope that\n"
"one day, they can use it to help bring peace to the world...\n"
"\n\n";
size=strlen(sentmp);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentmp[x]);
}
Sleep(2000);
system("cls");
char sentmpa[]="But one day, the evil witch DRUCILA cast an evil spell\n"
"on all the people who live in Wiza.\n"
"Her plan is to make all the people her slaves, so she can\n"
"have enough power to conquer the WHITE WILLOW, which is the\n"
"source of all our powers, and turn it evil...\n"
"\n\n";
size=strlen(sentmpa);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentmpa[x]);
}
Sleep(2000);
system("cls");
char sentmpb[]="But hope is not lost....\n"
"\n\n"
"I have been instructed by the WHITE WILLOW to challenge\n"
"DRUCIA and break her spell that she has over us.\n"
"I am all but an amatuer witch at the moment, that is why\n"
"I need your help to battle the monsters that DRUCILA has\n"
"crafted into Wiza...\n"
"I know if we work as a team, we can defeat DRUCILA and restore\n"
"peice to Wiza!\n"
"\n\n";
size=strlen(sentmpb);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentmpb[x]);
}
Sleep(2000);
system("cls");
SetConsoleTextAttribute ( h, wOldColorAttrs);
wizavillage();
} // end of plea
void wizavillage()
{
char sente[]="\tWIZA VILLAGE\n"
"\n\n"
"Welcome to my village.... Hmm, I guess it would be a good\n"
"Idea to stock up on magic or supplies before we venture into\n"
"The woods ahead, Ok then, were to first ";
size=strlen(sente);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sente[x]);
}
cout<<""<< pname <<"?"<<endl;
Sleep(2000);
system("cls");
signpost();
} // end function WizaVillage()
void signpost()
{
system("cls");
char sentf[]="Please Select a destination then hit ENTER\n"
"\n\n"
"Magic Shop == Press M\n"
"\n\n"
"Go to Wiza Woods == Press W\n"
"\n\n"
"Old Church == Press C\n"
"\n\n";
size=strlen(sentf);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentf[x]);
}
cout << "\tSelection: ";
cin >> choice;
}// end signpost
void endingANDcredits()
{
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
WORD wOldColorAttrs;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
/*
* First save the current color information
*/
GetConsoleScreenBufferInfo(h, &csbiInfo);
wOldColorAttrs = csbiInfo.wAttributes;
/*
* Set the new color information
*/
SetConsoleTextAttribute ( h, FOREGROUND_GREEN|FOREGROUND_INTENSITY );
system("cls");
char senteog[]="Drucila Falls to the floor and trys to grab you\n"
"as you take a step back from her...\n"
"\n\n"
"The chapel begins to tumble to the floor, you manage to\n"
"escape through the large window on your left hand side.\n"
"\n\n"
"You run and run as the cathedral tumbles down behind you.\n"
"\n\n"
"The sun breaks through the clouds as they turn from dark\n"
"to white\n"
"In the faint rays of the sun, the monsters that littered the\n"
"ground turn back to the once happy people of Wiza...\n"
"\n\n"
"You then arrive back in the town square, and recive three\n"
"huge cheers as the entire town turns out to give their thanks!\n"
"\n\n"
"The WHITE WILLOW begins to glow and sprout with joy once more...\n"
"\n\n"
"You can see the light flowing from it's glistening bark...\n"
"\n\n"
"\n\n"
"With Drucila now defeated, and the land of Wiza finaly free, you can\n"
"now take a well earned break....\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n"
"CONGATULATIONS!!!!!\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n";
size=strlen(senteog);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",senteog[x]);
}
Sleep(2000);
system("cls");
char senteogc[]="\tW I Z A D O R A\n"
"\t\n\n"
"\tProgramed by - Peter Watts\n"
"\t\n\n"
"\tWritten and Developed by - Peter Watts\n"
"\t\n\n"
"\tSound and Music - Steve THE MAN Childs\n"
"\t\n\n"
"\tSprite Design - Alan Pink\n"
"\t\n\n"
"\tText Color Program - Peter Watts\n"
"\t\n\n"
"\tMain dcpp Concept - Archwright Limited\n"
"\t\n\n"
"\tSpecial Thanks - Alan Pink\n"
"\t\n\n"
"\t Steve Childs\n"
"\t\n\n"
"\tLook out for the sequal soon!!!\n"
"\t\n\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n"
"\t\tT H E E N D\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n"
"\n\n";
size=strlen(senteogc);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",senteogc[x]);
}
Sleep(3000);
exit(0);
} // end of game