TheCompBoy.
#include <cstdlib>
#include <iostream>
using namespace std;
//The first startdoor that you can pick in the game
int normaldoor()
{
//Command that clears the console from text
system("CLS");
//some info about where you are.
cout << "You entered the room and you found a large room \n";
//the search char that will decide if you whana search or not
char search;
cout << "Do you whant to search the room? (y/n)";
cin >> search;
//If statement that tells you what happend if you search or not.
if (search == 'n')
cout << "Seems like you are not intrested in looking around \n you just walk to the next room.. \n";
else if (search == 'y')
{
cout << "You look around but find nothing but a bookshelf with some booring books \n";
cout << "You walk to the next room.. \n";
}
//Here is the char that will let you continue and clear the screen from text
char cont;
cin >> cont;
// Here the the command that clears the screen
system("CLS");
// Text that tells you that the dragon kills you..
cout << "In this room you find a big fire dragon.. \n";
cout << "He spits a big fireball at you and you die. n";
cout << "GAME OVER YOU DIED \n";
// char that make the program nu auto shutdown..
char end;
cin >> end;
return 0;
}
//The second startdoor you can pick in the game
int metaldoor()
{
//The command that clears the console
system("CLS");
// The info about the room you just entered
cout << "You entered the room and found some kind of old prison \n";
cout << "You look around and finds some skeleton's..\n";
// the scared char that will decide if you get scared of the skeleton's or not
char scared;
// do you get scared question
cout << "Do you get scared? (y/n)";
cin >> scared;
//The if statement that decide what happend if you get scared or not.
if (scared == 'n')
cout << "You don't get scared of that.. its not scary.. \n";
else if (scared == 'y')
{
cout << "You get scared and **** your pants.. \n";
cout << "But you don't find a way to clean yourself so \n";
cout << "you just try to ignore it \n";
}
//The beginning of the next room..
cout << "You walk to the next room.. \n";
cout << "Type some something to continue. \n";
//The continue that will clear the console and let you know what happends next
char cont;
cin >> cont;
// Command that clears the screen from text
system("CLS");
// Text that tells you that you won..
cout << "You found a way out of the castle.. \n";
cout << "YOU WIN! \n";
//char that makes the program not to auto shutdown.
char end;
cin >> end;
return 0;
}
//The 3rd startdoor you can pick in the game
int opendoor()
{
system("CLS");
cout << "You entered the room and you see some one sleeping in the couch..\n";
cout << "Do you whant to wake the person up and see whats going on? (y/n) \n";
//the char wake will decide if you shall wake the person up or not
char wake;
cin >> wake;
//The if statement that will decide your fate after deciding wake the mand or not
if (wake == 'n')
{
//what happends if you not wake the man
cout << "You don't whant to wake the person up you continue look around \n";
cout << "You find a big chest that seems to be unlocked.. \n";
cout << "You walk to the chest and start opening it... \n";
cout << "You look inside the chest and found a small peace of gold \n";
cout << "But now you hear a voice from behind..\n";
cout << "Hey! what the heck are you doin?? \n";
cout << "You turn around and see he holds a knife in his hand. \n";
cout << "You are unlucky the man that woke up stabs you in the belly \n";
cout << "Before you are able to take action.. \n";
cout << "GAME OVER YOU DIED! \n";
char end;
cin >> end;
}
else if (wake == 'y')
{
// what happends if you wake the man.
cout << "You step to the man and taps him on the shoulder.. \n";
cout << "Sir please wake up! \n";
cout << "The man gets so scared he picks up a knife and stab you \n";
cout << "You had no chance to take action.. \n";
cout << "GAME OVER YOU DIED! \n";
char end;
cin >> end;
}
return 0;
}
//Main function here the base of the game.
int main(int argc, char *argv[])
{
//The welcome screen / text
cout << "Welcome to castle adventures \n";
cout << "This small text-based game will take you through a castle..\n";
cout << "If you pick the wrong path something wrong will happend\n";
cout << "Type some random text to begin. if you type anything else than \n";
cout << "text the program will get error and shut down.. \n";
//char that makes the player have time to watch the text before it disapears
char begin;
cin >> begin;
//Command to clear the console from text
system("CLS");
//Beggining of the game
cout << "You just entered a castle that is very big.. you whant to explore it a bit..\n";
cout << "There is three doors infront of you..\n";
cout << "1. Just a normal wodden door. \n";
cout << "2. Spooky metal door. \n";
cout << "3. Small door that is little bit open and you can see a light from the\nroom behind it\n";
cout << "Choose door by typing 1-3\n";
//the int that will hold the door number.
int startdoor;
cin >> startdoor;
//The if that will make stuff happend depending which door you take.
//Also this if will take the game too a new function depending on what path you take.
if (startdoor == 1)
normaldoor();
else if (startdoor == 2)
metaldoor();
else if (startdoor == 3)
opendoor();
}


Sign In
Create Account


Back to top









