Advertisement
zachdyer

Console Based RPG

Dec 26th, 2012
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. #include<iostream>
  2. #include <stdlib.h>
  3. using namespace std;
  4.  
  5. int main(){
  6.    
  7.     cout << "<=======|==o RPG by zachdyer o==|========>\n" << endl;
  8.    
  9.     cout << "Enter a menu number." << endl;
  10.     cout << "1. New Game" << endl;
  11.    
  12.     int select;
  13.     cin >> select;
  14.    
  15.     if(select == 1){
  16.        
  17.         //Enter character name
  18.         char name[20];
  19.         cout << "Choose your character name" << endl;
  20.         cin >> name;
  21.        
  22.         bool running = true;
  23.         int room = 1;
  24.        
  25.         while(running == true){
  26.             //Begin quest
  27.             switch(room){
  28.                 case 1:
  29.                     cout << "You are in a room. There is a door to your left and a staircase going up." << endl;
  30.                     cout << "1. Go left" << endl;
  31.                     cout << "2. Go upstairs" << endl;
  32.                     cout << "3. Exit" << endl;
  33.                     cin >> select;
  34.                     if(select == 1){
  35.                         room = 2;
  36.                     }
  37.                     else if(select == 2){
  38.                         room = 3;
  39.                     }
  40.                     else if(select == 3){
  41.                         running = false;
  42.                     }
  43.                     break;
  44.                 case 2:
  45.                     cout << "You are in a room. There is a chest in front of you. There is a door behind you." << endl;
  46.                     cout << "1. Open chest" << endl;
  47.                     cout << "2. Go in door" << endl;
  48.                     cout << "3. Exit" << endl;
  49.                     cin >> select;
  50.                     if(select == 1){
  51.                         cout << "You opened the chest." << endl;
  52.                     }
  53.                     else if(select == 2){
  54.                         room = 1;
  55.                     }
  56.                     else if(select == 3){
  57.                         running = false;
  58.                     }
  59.                     break;
  60.                 case 3:
  61.                     cout << "You are in a room. There is a bed in the room. There are stairs going down." << endl;
  62.                     cout << "1. Go to bed" << endl;
  63.                     cout << "2. Go downstairs" << endl;
  64.                     cout << "3. Exit" << endl;
  65.                     cin >> select;
  66.                     if(select == 1){
  67.                         cout << "You go to bed." << endl;
  68.                     }
  69.                     else if(select == 2){
  70.                         room = 1;
  71.                     }
  72.                     else if(select == 3){
  73.                         running = false;
  74.                     }
  75.                     break;
  76.             }
  77.            
  78.         }
  79.        
  80.        
  81.     }
  82.    
  83.     return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement