Fully Featured & Customizable Free Forums | Welcome to C++ Game Dev. We hope you enjoy your visit.
You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.
Join our community!
If you're already a member please log in to your account to access all of our features:
|
Escape The Cave!, Inspired by Kaz's Classic
| Ludamad |
|
Mega Member
    
Group: Members
Posts: 97
Member No.: 47
Joined: 17-January 06

|
 ESCAPE THE CAVE!  Press X to quit. Dying restarts the game, losing all items you got. If you really want the answer to the riddle PM me or look at the code. | CODE | #include <cstdlib> #include <iostream> using namespace std; /* the global vars */ bool key; bool knowpass; string event; char pick; bool monsterone; bool food; bool treasure; bool knowdennis; /**/
int init_vars(void) { food=0; key=0; knowpass=0; event="start"; monsterone=0; treasure=0; knowdennis=0; }
int main(void) { init_vars(); cout << "Type x or X at any time to quit.\n";
/*keep going until the game sends the signal to end*/ while (event != "end") { /* The events are things that can happen, idea from Save the princess*/
if (event=="start") { cout << " \nYou find yourself lost in a smelly cave.\nYou are brandishing a shiny sword for some reason and feel the urge to hold it \naloft. Well... now what? "; cout << "\n\n\nA: Stab yourself\nB: Walk into a wall\nC: Put a cloth over your face\nD: Walk forwards. \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou die! What did you think was going to happen? \n"; init_vars(); } if (pick == 'B' || pick == 'b') { cout << "\nWell... that was pointless \n"; } if (pick == 'C' || pick == 'c') { cout << "\nThe stench bothers you less \n"; event="nosmell"; } if (pick == 'D' || pick == 'd') { cout << "\nYou leave and the overwhelming putrid smell kills you \n"; init_vars(); } if (pick == 'K' || pick == 'k') { if (knowpass==0) { cout << "\nYou find a small man that you didn't notice before, he asks for a password,\nunfortunately you guess wrong \n"; } else { cout << "\nYou find the small man, he asks you for a password, you give him it.\n He gives you a key."; key=1; } event = "start"; } }
if (event=="nosmell") { cout << " \nYou are brandishing a shiny sword for some reason and feel the urge to hold it \naloft. Well... now what? "; cout << "\n\n\nA: Stab yourself\nB: Walk into a wall\nC: Walk forwards\nD: Take off cloth\n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou die! What did you think was going to happen?\n"; init_vars(); } if (pick == 'B' || pick == 'b') { cout << "\nWell... that was pointless \n"; } if (pick == 'C' || pick == 'c') { cout << "\nYou continue onward\n"; event="farther"; } if (pick == 'D' || pick == 'd') { cout << "\nYou take it off\n"; event="start"; } if (pick == 'K' || pick == 'k') { if (knowpass==0) { cout << "\nYou find a small man that you didn't notice before, he asks for a password,\nunfortunately you guess wrong \n"; event = "nosmell"; } else { cout << "\nYou find the small man, he asks you for a password, you give him it.\n He gives you the key of doom."; event = "nosmell"; key=1; } event = "nosmell"; } }
if (event=="farther") { cout << "\n There are three paths you can travel on.\n And you can go back if you really want."; cout << "\n\n\nA: Go to the leftmost path\nB: Go to the middle path\nC: Go to the rightmost path\nD: Walk backwards. \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou travel on the leftmost path. \n"; if (monsterone==0) { event = "leftpathwithmonster"; } else { event="leftpath"; } } if (pick == 'B' || pick == 'b') { cout << "\nYou travel on the middle path. \n"; event="middlepath"; } if (pick == 'C' || pick == 'c') { cout << "\nYou travel on the rightmost path \n"; event="rightpath"; } if (pick == 'D' || pick == 'd') { cout << "\nYou walk backwards to the where you were before.\n"; event = "nosmell"; } }
if (event=="leftpathwithmonster") { cout << "\n You travel along the left path and encounter a monster. \n The monster is big."; cout << "\n\n\nA: Stab it!\nB: Ask the monster to leave\nC: Go back\nD: Walk onwards \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou stab the monster, the monster barely notices \n"; event = "leftpathwithmonster"; } if (pick == 'B' || pick == 'b') { cout << "\nThe monster leaves\n"; monsterone=1; event="leftpath"; } if (pick == 'C' || pick == 'c') { cout << "\nYou go back \n"; event="farther"; } if (pick == 'D' || pick == 'd') { cout << "\nYou are stopped in your attempt to go further by the monster.\n"; event = "leftpathwithmonster"; } }
if (event=="leftpath") { cout << "\n You are on the left path."; cout << "\n\n\nA: Stab yourself\nB: Dance \nC: Go back\nD: Walk onwards \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou die. Yay. \n"; init_vars(); } if (pick == 'B' || pick == 'b') { cout << "\nYou dance until you feel awkward. \n"; monsterone=1; event="leftpath"; } if (pick == 'C' || pick == 'c') { cout << "\nYou go back \n"; event="farther"; } if (pick == 'D' || pick == 'd') { cout << "\nYou continue left.\n"; event = "leftpathfarther"; } } if (event=="leftpathfarther") { cout << "\n You find a treasure chest, glowing with a rich creamy glow. \n You can't get any farther left than this. There is food on the floor."; cout << "\n\n\nA: Go back\nB: Open it \nC: Take food \nD: Dance \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou go back. \n"; event="leftpath"; } if (pick == 'B' || pick == 'b') { if (key==0) {cout << "\nYou try to open it with your bare hands, unfortunately it's locked. \n";} else { cout << "\nYou place the key inside and open it. \n"; if (treasure==0) {cout << "\nYou get the treasure. \n";} else {cout << "\nIt's already empty... \n";} treasure=1; } event="leftpathfarther"; } if (pick == 'C' || pick == 'c') { if (food==0) { cout << "\nYou take the food.\n"; } else { cout << "\nYou already took the food.\n"; } food=1; event="leftpathfarther"; } if (pick == 'D' || pick == 'd') { cout << "\nYou dance. Yay.\n"; event = "leftpathfarther"; } }
if (event=="middlepath") { cout << " \n You find a talking gerbil, he eyes you. You wonder how you know it can talk."; cout << "\n\n\nA: Talk to the gerbil\nB: Play with the gerbil\nC: Go backwards\nD: Walk forwards. \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nThe gerbil tells you that it is very bored.\n"; event="middlepath"; } if (pick == 'B' || pick == 'b') { cout << "\nThe gerbil giggles, he then tells you that the man ahead is named Dennis. \n"; knowdennis=1; event="middlepath";} if (pick == 'C' || pick == 'c') { cout << "\nYou go backwards \n"; event="farther"; } if (pick == 'D' || pick == 'd') { cout << "\nYou leave.\n"; event="middlefarther"; }
} if (event=="middlefarther") { cout << " \n You see a man pacing back and forth in deep thought. \nYou can't go any further on the middle path."; cout << "\n\n\nA: Talk to the man\nB: Punch a wall\nC: Walk backwards\nD: Spin around\n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { if (knowdennis ==0) {cout << "\nYou can't seem to get the man's attention.\n";} else { cout<<"\nYou call the man's name and he looks at you,\n he then says he'll let you in on a secret for food.\n"; if (food ==0) { cout << "\n You don't have any food.\n";} else { cout << "\n You give him food you found,\n he tells you about a key in the entrance of the cave.\n He tells you the password you need to get it is Boing.\n He also says something about typing K.\n"; knowpass=1; } } event="middlefarther"; } if (pick == 'B' || pick == 'b') { cout << "\nOww. \n"; event="middlefarther";} if (pick == 'C' || pick == 'c') { cout << "\nYou go backwards \n"; event="middlepath"; } if (pick == 'D' || pick == 'd') { cout << "\nWHEEEEEEEE!.\n"; event="middlefarther"; }
} if (event=="rightpath") { cout << " \nYou see a giant gate with a guard.\n He says in order to get through you need to pay."; cout << "\n\n\nA: Talk to the guard\nB: Sing a song\nC: Walk backwards\nD: Ask to go through gate\n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nThe guard chats with you about politics.\n"; event="rightpath"; } if (pick == 'B' || pick == 'b') { cout << "\nThe guard compliments you on your voice. \n"; event="rightpath";} if (pick == 'C' || pick == 'c') { cout << "\nYou go backwards \n"; event="farther"; } if (pick == 'D' || pick == 'd') { cout << "\nThe guard says he's tired of\n guarding the gate and will let you through for money.\n"; if (treasure==1) { cout << "\n You give the guard your treasure and he let's you through. \n He says once you go through you can't go back. \n He decides to travel alongside you."; event="superpath"; } else {event="rightpath";} }
}
if (event=="superpath") { cout << " \nYou are on the otherside of the gate. The guard says an exit is not far off."; cout << "\n\n\nA: Stab yourself\nB: Go forward\nC: Dance!!\nD: Go back \n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou die! What did you think was going to happen? \n"; init_vars(); } if (pick == 'B' || pick == 'b') { cout << "\nYou continue on your journey.\n"; event="computerplace"; } if (pick == 'C' || pick == 'c') { cout << "\nYou feel cool.\n"; event="superpath"; } if (pick == 'D' || pick == 'd') { cout << "\nYou can't."; event="superpath"; } } if (event=="computerplace") { cout << " \nYou find yourself in a high tech room.\n There is a riddle on the screen of a computer.\n It reads: Two of these doors lead to doom, the other to safety.\n The clue is that two of the doors have a lie written on them,\n the other the truth."; cout << "\n\n\nA: Enter door A which says: Door B has a lie on it\nB: Enter door B which says A is lying and C is the right door\nC: Enter door C which says door B is not the correct door and that A is telling the truth.\nD: Leave\n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou die! You picked the wrong door and get spammed by noobs to death!\n"; init_vars(); } if (pick == 'B' || pick == 'b') { cout << "\nYou die! You picked the wrong door and get eaten by Alpha_Man! \n"; init_vars(); } if (pick == 'C' || pick == 'c') { cout << "\nYou die... just kidding you enter the correct door!\n"; event="superpathplus"; } if (pick == 'D' || pick == 'd') { cout << "\nOK."; event="superpath"; } } if (event=="superpathplus") { cout << " \nYou find yourself outside. You find a monster here. "; cout << "\n\n\nA: Stab it!!\nB: Wait\nC: Think about life\nD: Kick the monster\n"; cin >> pick; if (pick == 'X' || pick == 'x') { cout << "\nQuitter! \n"; system("PAUSE"); exit(1); } if (pick == 'A' || pick == 'a') { cout << "\nYou stab the monster! You are finally free and safe! YOU WIN!!"; cout << "\nCoding by Ludamad \n Inspired by 'Save the princess' by Kaz \n Special thanks to Gamehawk and Alpha Man\n"; system("PAUSE"); exit(1); } if (pick == 'B' || pick == 'b') { cout << "\nYou wait... \n"; event="superpathplus"; } if (pick == 'C' || pick == 'c') { cout << "\nYou wonder what happens when you die, the monster feels neglected.\n"; event="superpathplus"; } if (pick == 'D' || pick == 'd') { cout << "\n You kick the monster. The monster runs away, and you feel happy. \n The guard says goodbye and leaves. \n You go to your house and go onto 64digits.com. \n You read about GML_Josea's crappy life. YOU WIN!!"; cout << "\n Coding by Ludamad \n Inspired by 'Save the princess' by Kaz \n Special thanks to Gamehawk, Alpha Man, GML_Josea and FirestormX\n Have a good day!\n"; system("PAUSE"); exit(1); } }
}
system("PAUSE"); return 0; }
|
|
|
|
 Join the millions that use us for their forum communities. Create your own forum today.
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|