Code:
#include<iostream>
#include<string>
#include<conio.h>
#include<algorithm>
#include<vector>
#include<cctype>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
using namespace std;
void intro();
void game(); // functions defined
void status();
void townsign();
void gameover();
void endcredits();
char pname[64];
char attack;
char choice;
int gold = 0; // player varibles
int level = 1;
int Exp = 0;
int health = 100, MinHealth = 0, MaxHealth = 200; // player health
int items = 0;
char enemy[64];
int Ehealth;
int Edamage;
int Emindamage; // enemy varibles
int Emaxdamage;
bool Ealive;
bool Edead;
int size; // used for text scroll
int x;
int chapter; // level varible name
int main()
{
intro();
game();
status();
townsign();
gameover();
endcredits();
} // end main()
void intro()
{
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
printf("\t\t|=================================|\n"
"\t\t| D A I S Y 'S Q U E S T |\n"
"\t\t| |\n"
"\t\t| Press P to Play |\n"
"\t\t| |\n"
"\t\t| Press L to Load Game |\n"
"\t\t| |\n"
"\t\t| Press Q to Quit |\n"
"\t\t|=================================|\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\t\tProgramed By Peter Watts\n");
Sleep(100);
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
Sleep(100);
printf("\n");
cout << "Selection: " << endl;
cin >> choice;
if (choice == 'p')
{
game();
}
else if (choice == 'q')
{
system("cls");
printf("Goodbye, Daisy hopes to see you soon...\n");
Sleep(3000);
exit(0);
}
else if (choice == 'l')
{
system("cls");
printf("Sorry, the LOAD feature is not yet avalible...\n");
Sleep(3000);
intro();
}
} // ends intro()
void game()
{
/* SET ENEMY VARIBLES FOR FOLLOWING GAME FUNCTION*/
if (chapter == 1)
{
{
char enemy[64]="small dog";
Ehealth = 20;
Edamage = 10;
Emaxdamage = 10;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="disfigured girl";
Ehealth = 40;
Edamage = 15;
Emaxdamage = 20;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="small bat";
Ehealth = 10;
Edamage = 5;
Emaxdamage = 5;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="Villager Boss";
Ehealth = 80;
Edamage = 10;
Emaxdamage = 15;
Emindamage = 0;
Ealive = true;
}
}
else if (chapter == 2)
{
{
char enemy[64]="sewer spider";
Ehealth = 20;
Edamage = 10;
Emaxdamage = 15;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="sewer worker";
Ehealth = 30;
Edamage = 15;
Emaxdamage = 15;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="mutant snail";
Ehealth = 40;
Edamage = 20;
Emaxdamage = 20;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="caged worm demon Boss";
Ehealth = 100;
Edamage = 15;
Emaxdamage = 20;
Emindamage = 0;
Ealive = true;
}
}
else if (chapter == 3)
{
{
char enemy[64]="spirit sailor";
Ehealth = 0;
Edamage = 0;
Emaxdamage = 0;
Emindamage = 0;
Ealive = true;
Edead = true;
}
{
char enemy[64]="haunted book";
Ehealth = 25;
Edamage = 10;
Emaxdamage = 10;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="phamtom of the Oprea";
Ehealth = 40;
Edamage = 30;
Emaxdamage = 20;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="evil fairy Boss";
Ehealth = 150;
Edamage = 40;
Emaxdamage = 25;
Emindamage = 0;
Ealive = true;
}
}
else if (chapter == 4)
{
{
char enemy[64]="castle soldier";
Ehealth = 30;
Edamage = 15;
Emaxdamage = 20;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="resident monk";
Ehealth = 30;
Edamage = 15;
Emaxdamage = 15;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="spider hunter";
Ehealth = 40;
Edamage = 20;
Emaxdamage = 25;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="dark servent";
Ehealth = 50;
Edamage = 30;
Emaxdamage = 30;
Emindamage = 0;
Ealive = true;
}
{
char enemy[64]="drucia Final Boss";
Ehealth = 300;
Edamage = 50;
Emaxdamage = 25;
Emindamage = 10;
Ealive = true;
}
}
/* SET PLAYER UPGRADE VARIBLES FOR GAME()*/
if (Exp == 6)
{
cout << "You have reached Level 2!\n" << endl;
level=+1;
}
else if (Exp == 12)
{
cout << "You have reached Level 3!\n" << endl;
level=+1;
}
else if (Exp == 21)
{
cout << "You have reached Level 4!\n" << endl;
level=+1;
}
else if (Exp == 33)
{
cout << "You have reached Level 5!\n" << endl;
level=+1;
}
else if (Exp == 48)
{
cout << "You have reached Level 6!\n" << endl;
level=+1;
}
else if (Exp == 69)
{
cout << "You have reached Level 7!\n" << endl;
level=+1;
}
else if (Exp == 92)
{
cout << "You have reached Level 8!\n" << endl;
level=+1;
}
/* GAME OVER*/
if (health <=0) // if player health drops below or equal to zero, then gameover function is called
{
gameover();
}
system("cls");
char senta[]="Hello there!\nWould you like to do a poor Princess a big favour?\n"
"I hope you will help me, as my land is in terrible danger...\n"
"We have been over-run by Drucila's evil army of demons.\n"
"I have tried my hand at fighting back, but it has come to no\n"
"avail...\n"
"\n\n"
"So, will you help me?\n"
"\n\n";
size=strlen(senta);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",senta[x]);
}
cout << "Will you help? (Y/N) " << endl;
cin >> choice;
if (choice == 'n')
{
system("cls");
char sentwh[]="Oh well, I suppose it was worth me asking....\n"
"It's a shame though, you could of been my ideal\n"
"adventurer...\n"
"\n\n";
size=strlen(sentwh);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentwh[x]);
}
Sleep(2000);
gameover();
}
else if (choice == 'y')
{
system("cls");
items=+1;
gold=+100;
Exp=+1;
char sentb[]="Oh thank you so much adventurer!\nHold on, I am a Princess! I don't\n"
"think I should be addressing you as adventurer now should I?\n"
"So, brave traveller, what do I call you? ";
size=strlen(sentb);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentb[x]);
}
cin >> pname;
system("cls");
char sentc[]="I do appoligise ";
size=strlen(sentc);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentc[x]);
}
printf("%s!",pname);
char sentd[]="\n\n"
"It was my poor mannors. So then, as you have been so very kind\n"
"in assisting me defeat Drucila, I give you some GOLD and a LETTER\n"
"Please take care of the letter, it was a sort of family airloom.\n"
"Well, enough of all this chat, lets get going....\n"
"\n\n";
size=strlen(sentd);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentd[x]);
}
Sleep(2000);
}
system("cls");
cout << "\t\tMake a Selection...\n" << endl;
cout << "\tPress E to explore the area\n" << endl;
cout << "\tPress S to view your stats\n" << endl;
cout << "\n\n";
cin >> choice;
if (choice == 's')
{
status();
}
else if (choice == 'e')
{
system("cls");
char sente[]="You walk around for a bit and find yourself inside a large\n"
"town square. Before you is a sign post, you look up and\n"
"discover that it has a few directions displayed on it..\n"
"\n\n";
size=strlen(sente);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sente[x]);
}
Sleep(2000);
townsign();
}
if (choice == 'd' && items == 1)
{
system("cls");
char sentil[]="The inn seems to be locked, maybe the inn keeper has gone out\n"
"somwhere....\n";
size=strlen(sentil);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentil[x]);
}
Sleep(2000);
townsign();
}
else if (choice == 'd' && items == 2)
{
system("cls");
char sentdi[]="\t\tDRAKES INN\n"
"\n\n"
"You enter the cosy inn, and a petite young lady is stood\n"
"behind the counter smiling at you.\n"
"\n\n"
"She asks you how she can help you, then offers a selection of\n"
"choices...\n"
"\n\n"
"Spend the night - 20 gold (Press S)\n"
"\n\n"
"Eat a hearty meal - 10 gold (Press E)\n"
"\n\n"
"Nothing really - FREE!! (Press N)\n"
"\n\n";
size=strlen(sentdi);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentdi[x]);
}
cout << "Selection: " << endl;
cin >> choice;
}
endcredits();
} // ends game(), hence, the whole program
void status()
{
system("cls");
cout << "\t\tS T A T U S\n" << endl;
cout << "\n\n";
cout << "Player Name: " << pname;
cout << "\n\n";
cout << "Items Found: " << items;
cout << "\n\n";
cout << "Player life: " << health;
cout << "\n\n";
cout << "Total Gold: " << gold;
cout << "\n\n";
cout << "Ezperience: " << Exp;
cout << "\n\n";
cout << "Player Levl: " << level;
cout << "\n\n";
cout << "Hit a key!\n" << endl;
getch();
system("cls");
} // end of status()
void townsign()
{
system("cls");
char sentf[]="\t\tFaucet Town Square\n"
"\n\n"
"Press D for drakes inn\n"
"\n\n"
"Press M for Faucet market\n"
"\n\n"
"Press C for the old church\n"
"\n\n";
size=strlen(sentf);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentf[x]);
}
cout << "Selection: " << endl;
cin >> choice;
}
void gameover()
{
system("cls");
char sentgo[]="You fall to floor, all your life force\n"
"now extinguished. Daisy's Kingdom is now doomed..\n"
"\n\n"
"\n\n\n\n\n\t\tG A M E O V E R . . .\n"
"\n\n";
size=strlen(sentgo);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentgo[x]);
}
Sleep(3000);
exit(0);
} // end of gameover()
void endcredits()
{
system("cls");
char sentec[]="\t\tD A I S Y'S Q U E S T\n"
"\n\n"
"\tProgramed by: Peter Watts\n"
"\n\n"
"\tMusic and Fx: Peter Watts\n"
"\n\n"
"\tGraphic Design: Alan Pink\n"
"\n\n"
"\tI would likw to thank a few people, as if it\n"
"\n\n"
"\twas not for their hard work, this project would\n"
"\n\n"
"\tnot of been finished.... Firstly myself for putting\n"
"\n\n"
"\tup with so many stupid little errors in syntax,\n"
"\n\n"
"\tsecond to alan for his skilled hand on 'PAINT', and\n"
"\n\n"
"\tfinally, I would like to thank you, YES YOU... because\n"
"\n\n"
"\twithout you playing it, then it would only mean a waste of\n"
"\n\n"
"\ttime for me...\n"
"\n\n"
"\n\n"
"\n\n"
"\t\t\t\tF I N\n"
"\n\n"
"\n\n"
"\t\tAs you leave the kingdom, you see a shadow of a recent foe\n"
"\n\n"
"\t\tstanding over you....\n"
"\n\n";
size=strlen(sentec);
for(x=0;x<size;x++)
{
Sleep(40);
printf("%c",sentec[x]);
}
Sleep(3000);
exit(0);
} // end of gamecredits()