Code:
#include <iostream>
#include <vector>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
using namespace std;
class GameSetUp;
// Main Varibles: //
/* Used for player only*/
string Player; // used as players name //
char enter; // used to skip screens //
char attack; // used as attack command //
int gold = 0; // Set gold collected to zero for game start //
int score = 0; //score varible at start of game to zero //
int health = 100; // Set player Health to 100 at game start //
char items =0; //found to zero at game start //
int purchase; // varible used to buy from magical store //
int magicLevel = 20; // varible for magiv levels //
/* Class varible;s to reconise Level Names*/
void Instructions(); // to see instruction screen //
void Level1(); // HALLIWELL MANNOR //
void Level2(); // NIGHTCLUB P 3 //
void Level3(); // BAY MIRROR NEWSPAPER //
void Level4(); // 1930'S NEW YORK //
void Level5(); // PAIGE'S CRYPT //
void Ending(); // Displa ending text on game completion //
void Credits(); // Shows who made game erm me then!! //
/* Enemy varibles*/
int mysticalBat = 10; // bat health is 10 points //
int snake = 20; // snake health is 20 points //
int demon = 60; // demon health is 50 points //
int spider = 60; // spider health is 60 points //
int dog = 80; // dog health is 80 points //
int crow = 30; // crow health is 30 points //
int zombie = 80; // zombie health is 80 points //
int girlboss = 200; // First boss is 200 points //
int mysticalWizardBoss = 400; // Second boss is 400 points //
int twinsBoss = 600; // Third boss is 600 points //
int mechaSpiderBoss = 800; // Fourth Boss is 800 points //
int pageDarksideBoss = 1500; // Final boss is 1500 points //
/* Item lists declaration */
char key;
char wand;
char water;
char fire;
char ice; // varibles called on when needed //
char lifeBolt;
char mysticalPowder;
char essenceOfChildren;
char POWEROFTHREE;
////////////////////////////////////////////////////////////////////////////////
// END OF DECLARATIONS //
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
class MainGame;
class introScreen;
cout << "\n\n";
cout << "\n\n";
cout << "\t\tC H A R M E D\n\n" << endl;
cout << "\n\n";
cout << "\n\n";
cout << "\t\tWritten by Peter Watts (c) 2005 - 2009" << endl;
cout << "\n\n";
cout << "\n\n";
cout << "\t\tPress any key you wish to read instructions...\n\n";
cout << "\n\n";
getch();
class Instructions;
system("cls");
cout << "\t\t\tHOW TO PLAY\n\n" << endl;
cout << "\n\n";
printf("Charmed is a simple folow the text and press the right keys game.\n\n");
printf("All you have to do is read the text then by pressing the right\n\n");
printf("keys, you will overcome the various challenges. You have a health\n\n");
printf("meter that is set to 100 points. If you answer a wrong question or\n\n");
printf("are hurt by an enemy, it will decrease. If it reaches zero, you will\n\n");
printf("be killed. You only get the one life. Along the way, you can inprove\n\n");
printf("your health and collect gold to buy new spells. Your attack level will\n\n");
printf("also increase as you get stronger, allowing you to perform better attacks\n\n");
printf("GOOD LUCK TO YOU! \n\n");
cout << "\n\n";
cout << "Press a key..." << endl;
cout << "\n\n";
getch();
class NameEntry;
system("cls");
cout << "\t\t\tWHO ARE YOU AGAIN?\n\n" << endl;
cout << "\n\n";
cout << "Please enter your name: " << Player;
cin >> Player;
class SubScreen;
system ("cls");
cout << "Welcome " << Player;
cout << "\n\n";
cout << "\t\t\tTHIS IS YOUR CURRENT STATE OF PLAY\n\n" << endl;
cout << "\n\n";
cout << "Your Health is " << health;
cout << "\n\n";
cout << "The amount of gold you have is " << gold;
cout << "\n\n";
cout << "Your score so far is " << score;
cout << "\n\n";
cout << "Items so far " << items;
cout << "\n\n";
cout << "Magic Level " << magicLevel;
cout << "\n\n";
cout << "Press a key to get going..." << endl;
cout << "\n\n";
getch();
class Level_Halliwell_Mannor;
system("cls");
cout << "\tHalliwell Mannor - LEVEL 1\n\n" << endl;
cout << "\n\n";
cout << "You are stood outside the charmed estate, known as 'Halliwell Mannor'" << endl;
cout << "\n\n";
cout << "But Before we can start, you need to choose your charmed one!" << endl;
cout << "\n\n";
cout << "Press 1 for piper" << endl;
cout << "\n\n";
cout << "Press 2 for pheobe" << endl;
cout << "\n\n";
cout << "Press 3 for paige" << endl;
cout << "\n\n";
cout << "Your Selection: " << endl;
int choice;
cin >> choice;
// if case not detected game contine.. so... //
// rand() switch: choice FALSE; continue end(0); //
switch (choice) {
case 1:
system("cls");
cout << "You have chosen Piper." << endl;
cout << "\n\n";
cout << "She has an magic level is 20" << endl;
cout << "\n\n";
cout << "Press any key to continue!" << endl;
getch();
break;
case 2:
system("cls");
cout << "You have chosen Pheobe." << endl;
cout << "\n\n";
cout << "She has an magic level is 20" << endl;
cout << "\n\n";
cout << "Press any key to continue!" << endl;
getch();
break;
case 3:
system("cls");
cout << "You have chosen Paige." << endl;
cout << "\n\n";
cout << "She has an magic level is 20" << endl;
cout << "\n\n";
cout << "Press any key to continue!" << endl;
getch();
break;
default:
system("cls");
cout << "Thats not a seletion, go back to magic school!!" << endl;
break;
}
system("cls");
cout << "The three charmed sisters are all sat around the table in the" << endl;
cout << "\n\nlounge. 'I miss Pru...' muttered Piper. Paige and Pheobe both" << endl;
cout << "\n\nagreed. Suddenly, Paige jumped up and had an idea. 'What if we could";
cout << "\n\nresurect Pru? We are witches, there must be a way to do it!" << endl;
cout << "\n\nOk then, Paige, will will try it. Lets look around the mannor" << endl;
cout << "\n\nfor some ideas." << endl;
cout << "\n\n";
cout << "Press any key" << endl;
cout << "\n\n";
getch();
system("cls");
cout << "Hey, " << Player;
cout << "\n\n";
cout << "Dont forget your computer login...." << endl;
cout << "Username: rose" << endl;
cout << "Password: halliwell" << endl;
cout << "\n\n";
cout << "Hit a key!" << endl;
getch();
// code for snake enemy folows, program should NOT vaiger!!!!! //
system("cls");
cout << "Oh no! " << Player;
cout << "\n\n";
cout << "Has encountered a snake!!!" << endl;
cout << "\n\n";
cout << "Time to battle!!" << endl;
cout << "\n\n";
cout << "Press any key.." << endl;
cout << "\n\n";
getch();
system("cls");
cout << "The snake attacks you but misses! Heres your chance to attack!!" << endl;
cout << "\n\n";
cout << "Press y to attack or x to try to get past!!" << endl;
cout << "\n\n";
cin >> attack;
if (attack == 'y') { // IF statement to tell computer of user choice //
system("cls");
cout << "You fired a light bolt at the snake, it was damaged!" << endl;
snake=snake-10;
cout << "\n\n";
cout << "Its Health is now " << snake;
cout << "\n\n";
cout << "It attacks again but the damage to you is slight as you have" << endl;
cout << "\n\n";
cout << "Weakened it." << endl;
health=health-5;
cout << "\n\n";
cout << "Your health is " << health; // calls varibles of health and snake //
cout << "\n\n";
score=score+100;
cout << "Will you attack or flee?... y attack x flee" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "You attack the snake again with another bolt of light..." << endl;
snake=snake-10;
cout << "\n\n";
cout << "It's health is " << snake;
cout << "\n\n";
cout << "It dies before your eyes... YOUR MAGIC LEVEL HAS INCREASED!" << endl;
magicLevel=magicLevel+10; // Calls varible of magic level //
score=score+200;
cout << "\n\n";
cout << "Press any key" << endl;
getch();
}
else if (attack =='x') {
system("cls");
cout << "You ran past the snake, but you are bitten as you do!" << endl;
cout << "\n\n";
health=health-20;
cout << "Your health is " << health;
cout << "\n\n";
cout << "Press any key!" << endl;
getch();
}
system("cls");
cout << "After the snake encounter, " << Player;
cout << "\n\n";
cout << "wonders why the snake would of attacked, and where it came from!!" << endl;
cout << "\n\n";
cout << "No matter, you say to yourself as you continue to search the mannor." << endl;
cout << "\n\n";
cout << "Hit a key!!" << endl;
getch();
system("cls");
cout << "In your seach, you come accross some gold coins!!!" << endl;
gold=gold+20;
cout << "\n\n";
cout << "'ts supprising how fogetfull the other two Halliwells can be..'" << endl;
cout << "\n\n";
cout << "You mutter to yourself as you continue the search." << endl;
cout << "\n\n";
cout << "Hold on, whats this........" << endl;
cout << "\n\n";
cout << "It's a key!" << endl;
cout << "\n\n";
items=items+1; // add item to quanity of zero //
char items[64]="key"; // place varible of key //
cout << "Press any key" << endl;
getch();
class SubScreen;
system ("cls");
cout << "Welcome " << Player;
cout << "\n\n";
cout << "\t\t\tTHIS IS YOUR CURRENT STATE OF PLAY\n\n" << endl;
cout << "\n\n";
cout << "Your Health is " << health;
cout << "\n\n";
cout << "The amount of gold you have is " << gold;
cout << "\n\n";
cout << "Your score so far is " << score;
cout << "\n\n";
cout << "Items so far " << items;
cout << "\n\n";
cout << "Magic Level " << magicLevel;
cout << "\n\n";
cout << "Press a key" << endl;
cout << "\n\n";
getch();
system("cls");
cout << "Full of mystery, " << Player;
cout << "\n\n";
cout << "runs down the hallway and finds the other two sisters franticly" << endl;
cout << "\n\n";
cout << "searching for other clues that may help. 'Hey, guys!' shouts " << Player;
cout << "\n\n";
cout << "I found a key and had a fight with a big snake. I tell you what," << endl;
cout << "\n\n";
cout << "Theres alot of mystery in this place." << endl;
cout << "\n\n";
cout << "Press any key";
getch();
system("cls");
cout << "Oddly, the other sisters ignore you and continue their search." << endl;
cout << "\n\n";
cout << "You turn around and stare blanky at the wall for a few moments" << endl;
cout << "\n\n";
cout << "before turning back and discover that your sisters have vanished!!" << endl;
cout << "\n\n";
cout << "SISTERS!!!! WHERE ARE YOU BOTH!! Shouts " << Player;
cout << "\n\n";
cout << "Hit a key";
getch();
system("cls");
cout << "Suddenly, a demon appears in front of you...." << endl;
cout << "\n\n";
cout << "Rather unfairly, he swipes at you and inflicts damage!" << endl;
health=health-10;
cout << "\n\n";
cout << "Your health is now " << health;
cout << "\n\n";
cout << "What will you do? press y to attack or x to flee!" << endl;
cout << "\n\n";
cin >> attack;
if (attack == 'y') { // IF statement to tell computer of user choice //
system("cls");
cout << "You fired a light bolt at the demon, it was damaged!" << endl;
demon=demon-20;
cout << "\n\n";
cout << "Its Health is now " << demon;
cout << "\n\n";
cout << "It attacks again but the damage to you is slight as you have" << endl;
cout << "\n\n";
cout << "Weakened it." << endl;
health=health-5;
cout << "\n\n";
cout << "Your health is " << health; // calls varibles of health and snake //
cout << "\n\n";
score=score+100;
cout << "Will you attack or flee?... y attack x flee" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "You attack the demon again with another bolt of light..." << endl;
demon=demon-20;
cout << "\n\n";
cout << "It's health is " << demon;
cout << "\n\n";
cout << "It staggers back... " << endl;
cout << "\n\n";
cout << "Then manages to hit you too!" << endl;
health=health-20;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "What will you do? ... y attack x flee" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "You muster enough stengh and attack it again..." << endl;
demon=demon-20;
cout << "\n\n";
cout << "It's health is now " << demon;
cout << "\n\n";
cout << "You manage to avoid its attack as it falls to the floor and dies.." << endl;
cout << "\n\n";
cout << "MAGIC LEVEL INCREASED!" << endl;
magicLevel=magicLevel+10;
score=score+3000;
cout << "\n\n";
cout << "Press any key" << endl;
getch();
}
else if (attack =='x') {
system("cls");
cout << "You ran past the demon but you are hurt badly!" << endl;
cout << "\n\n";
health=health-40;
cout << "Your health is " << health;
cout << "\n\n";
cout << "Press any key!" << endl;
getch();
}
class SubScreen;
system ("cls");
cout << "Welcome " << Player;
cout << "\n\n";
cout << "\t\t\tTHIS IS YOUR CURRENT STATE OF PLAY\n\n" << endl;
cout << "\n\n";
cout << "Your Health is " << health;
cout << "\n\n";
cout << "The amount of gold you have is " << gold;
cout << "\n\n";
cout << "Your score so far is " << score;
cout << "\n\n";
cout << "Items so far " << items;
cout << "\n\n";
cout << "Magic Level " << magicLevel;
cout << "\n\n";
cout << "Press a key" << endl;
cout << "\n\n";
getch();
system("cls");
cout << "As you walk towards the doorway, a field of magic appears around the" << endl;
cout << "\n\n";
cout << "exitway. You can use the computer to get past!" << endl;
cout << "\n\n";
cout << "Hit a key to login!" << endl;
getch();
class computerLogin;
system("cls");
cout << "\t\t\tH-MANNOR SYSTEM NETWORK\n\n" << endl;
cout << "\n\n";
int security = 0;
string user;
cout << "\nUsername: ";
cin >> user;
cout << "\n\n";
string password;
cout <<"\nPassword: ";
cin >> password;
if (user == "rose" && password == "halliwell")
{
cout << "\n\n";
cout << "Correct login... You may continue" << endl;
cout << "\n\n";
cout << "Hit a key to go on!" << endl;
getch();
}
else if (!security) {
health=health-500;
cout << "\n\n";
cout << "Invalid login" << endl;
cout << "\n\n";
cout << "Your Health is drained to zero GAME OVER!!!!!!" << endl;
cout << "(maybe READ text better next time around hmmmm)" << endl;
cout << "\n\n";
system("pause");
exit(0);
}
system("cls");
cout << "Well done " << Player;
cout << "\n\n";
cout << "You deserve some help." << endl;
cout << "\n\n";
cout << "You have been awarded with health" << endl;
health=health+50;
cout << "\n\n";
cout << "Your health is now " << health;
cout << "\n\n";
cout << "hit a key!";
getch();
//////////////////BOSS FIGHT////////////////////////////////////////////////////
class girlboss;
// boss health may drop on attack levels..... ///
// may depend on player progress so far //
system("cls");
cout << "\t\t\tMYRA BOSS\n\n" << endl;
cout << "\n\n";
cout << "Myra, the headless girl ghost boss approches you. It seems to have" << endl;
cout << "\n\n";
cout << "more health than others you hsve faced before......" << endl;
cout << "\n\n";
cout << "She attaks you with an icy breath, but you mamnge to dodge it." << endl;
cout << "\n\n";
cout << "Select an option...." << endl;
cout << "\n\n";
cout << "Y to attack x to flee" << endl;
cin >> attack;
if (attack == 'y') {
system("cls");
cout << "You attack with a lighting bolt!" << endl;
cout << "\n\n";
girlboss=girlboss-10;
score=score+100;
cout << "Her health is " << girlboss;
cout << "\n\n";
cout << "She attacks you again but is sucesful!" << endl;
health=health-10;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "What will you do? attack y flee x" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "Her next attack seems more powerful than the last, she makes contact" << endl;
health=health-20;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "As your blast hits her, she shuuders back....";
cout << "\n\n";
girlboss=girlboss-25;
score=score+100;
cout << "Her health is " << girlboss;
cout << "\n\n";
cout << "What will you do? attack y flee x" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "Her next attack seems more powerful than the last, she makes contact" << endl;
health=health-10;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "As your blast hits her, she shuuders back...." << endl;
cout << "\n\n";
girlboss=girlboss-25;
score=score+100;
cout << "Her health is " << girlboss;
cout << "\n\n";
cout << "What will you do? attack y flee x" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "Her next attack seems not as powerful than the last, she makes contact" << endl;
health=health-10;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "As your blast hits her, she shuuders back...." << endl;
cout << "\n\n";
girlboss=girlboss-25;
score=score+100;
cout << "Her health is " << girlboss;
cout << "\n\n";
cout << "What will you do? attack y flee x" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "Her next attack seems more powerful than the last, she makes contact" << endl;
health=health-10;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "As your blast hits her, she shuuders back...." << endl;
cout << "\n\n";
girlboss=girlboss-25;
score=score+100;
cout << "Her health is " << girlboss;
cout << "\n\n";
cout << "What will you do? attack y flee x" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "Her next attack seems more powerful than the last, she makes contact" << endl;
health=health-20;
cout << "\n\n";
cout << "Your health is " << health;
cout << "\n\n";
cout << "As your blast hits her, she shuuders back...." << endl;
cout << "\n\n";
girlboss=girlboss-50;
score=score+1000;
cout << "Her health is " << girlboss;
cout << "\n\n";
cout << "What will you do? attack y flee x" << endl;
cin >> attack;
}
if (attack == 'y') {
system("cls");
cout << "This isn't over " << Player;
cout << "\n\n";
cout << "I will be back!!!" << endl;
cout << "\n\n";
cout << "She screams as she vanishes....." << endl;
cout << "\n\n";
cout << "Press any key to continue...." << endl;
getch();
}
// THIS AINT ****ING WORKING RIGHT!!!!!!!!!! SCREAM!!!!!!!!!!!!!!!!!!!! //
else if (attack == 'x') {
system("cls");
cout << "You try to escape but are caught in her ice beam as you run!" << endl;
cout << "\n\n";
health=health-200;
cout << "IS THIS THE END OF " << Player;
cout << "\n\n";
cout << "Press any key to find out!" << endl;
getch();
}
system("cls");
cout << "MAGIC LEVEL INCREASED!!!" << endl;
magicLevel=magicLevel+1;
cout << "\n\n";
cout << "Hit a key!" << endl;
getch();
class SubScreen;
system ("cls");
cout << "Welcome " << Player;
cout << "\n\n";
cout << "\t\t\tTHIS IS YOUR CURRENT STATE OF PLAY\n\n" << endl;
cout << "\n\n";
cout << "Your Health is " << health;
cout << "\n\n";
cout << "The amount of gold you have is " << gold;
cout << "\n\n";
cout << "Your score so far is " << score;
cout << "\n\n";
cout << "Items so far " << items;
cout << "\n\n";
cout << "Magic Level " << magicLevel;
cout << "\n\n";
cout << "Press a key" << endl;
getch();
class gameover;
{
if (health <=0)
system("cls");
cout << "\n\n";
cout << "You are dead...GAMEOVER!" << endl;
cout << "\n\n";
system("pause");
exit(0);
}
system("pause");
}