ardixon
6/20/2013 - 2:58 PM

This is a text rpg about zombies.

This is a text rpg about zombies.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctime>

using namespace std;

// created by Austin Dixon 4/9/2010



   int main ()
   {int playagain, id, menuchoice, menuchoice2, menuchoice3, code, total, exit;

   //----------------------------
      cout << "Do you want to play Zombie Town?" << endl << endl <<
         "Choose 1 for yes." << endl << 
         "Choose 2 for no."; 
   
      cin >> playagain;
   
      while (playagain <=1)
      {
      
      //----------------------------
         cout << endl << endl << "     ZOMBIE TOWN";
      
         cout << endl << endl <<  "   _ __________=__" << endl <<
            "    \\@([____]_____|" << endl <<
            "   /|/-[____]" << endl <<
            "  /     /" << endl <<
            "  /____|" << endl <<
            "  |____/";
      //-------------------------------------------
         cout << endl << endl << "The years is 2023. Its the year of the zombie. A chemical" << endl <<
            "additive in watermelon flavored bubblegum sparked a genetic chain of" << endl <<
            "events, transforming most of the population into brain-hungry" << endl <<
            "zombies. It is a miricle that you have survived this long. You" << endl <<
            "walk down a deserted street. Suddenly, a man wearing camo" << endl <<
            "runs towards you. He asks you how old you are." << endl << endl <<      
            "** Enter your age **";     
      
         cin >> id;
      
         cout << endl << "So you're ";
         cout << id; 
         cout << " huh. Well then you're old enough to use a gun. Here, I have an extra" <<endl <<
            "glock, take it. You can't be too careful with all these brain-eaters around." << endl << endl;
         cout << "** What would you like to do? **" << endl << endl <<
            "* Choose 1 if you want to take the pistol." << endl <<
            "* Choose 2 if you want to hit the man in the face." << endl <<
            "* Choose 3 if you want to run away.";
      
         cin >> menuchoice;
      
      //---------------------------------------
         switch (menuchoice)
         { 
            case 0 : cout << endl << "Who said zero was an option? You take the pistol." << endl <<
                  "Just in time too, as you hear a blood-chilling groan behind you." << endl <<
                  "You turn and see a zombie reaching towards you."; 

               break;
            case 1 : cout << endl << "You take the pistol. Just in time too, as you hear a" << endl <<
                  "blood-chilling groan behind you. You turn and see" << endl <<
                  "a zombie reaching towards you."; 
               break;
            case 2 : cout << endl << "You pull back and punch the man square in the jaw." << endl <<
                  "He goes down hard. Serves him right for talking to you." << endl <<
                  "You decide to steal both of his guns. Just in time too," << endl <<
                  "as you hear a blood-chilling groan behind you. You turn and" << endl <<
                  "see a zombie reaching towards you.";
               break;     
            case 3 : cout << endl << "You run away. Hey, we cant all be brave. Maybe" << endl <<
                  "you should have taken the gun though. As soon as you" << endl <<
                  "turn the corner, you run smack into a hungry zombie.";
               break;
         
         }
      //----------------------------------------------
      
         cout << endl << endl << "** What would you like to do? **" << endl << endl <<
            "* Choose 1 if you want to shoot the zombie." << endl <<
            "* Choose 2 if you want to run away." << endl <<
            "* Choose 3 if you want to talk the zombie into not eating you.";
        	
         cin >> menuchoice2;
      
      
      //----------------------------------------------
      
         if (menuchoice<3)
         { 
            switch (menuchoice2)
            { 
               case 0 : cout << endl << "Zombie Town was created by Austin Dixon. It only recognizes numbers" << endl <<
                     "0-3, it doesn't understand words or symbols. On the plus side," << endl <<
                     "you never have to worry about this program eventually" << endl << "becoming skynet.";
               
                  break;
               case 1 : cout << endl << "You shoot the zombie in the head. Brains fly everywhere." << endl <<
                     "When you turn back around, the man in camo is gone." << endl <<
                     " You decide to start looking for a safe place to hide. There" << endl <<
                     "is an abandoned medical research facility up ahead. You" << endl <<
                     "wonder if there could be a cure to the zombie plague inside...";
                  cout << endl << endl << "** What would you like to do? **" << endl << endl <<
                     "* Choose 1 if you want to look for a cure." << endl <<
                     "* Choose 2 if you want to check the facility for zombies.";
               
                  break;
               case 2 : cout << endl << "You run away like a baby and hide in a dumpster until" << endl <<
                     "nightfall. When the coast seems clear, you climb out" << endl <<
                     "and start looking for a less smelly hiding place. There" << endl <<
                     "is an abandoned medical research facility up ahead. You" << endl <<
                     "think there might be a cure to the zombie plague inside.";
                  cout << endl << endl << "** What would you like to do? **" << endl << endl <<
                     "* Choose 1 if you want to look for a cure." << endl <<
                     "* Choose 2 if you want to check the facility for zombies.";
               
                  break;     
               case 3 : cout << endl << "You try to reason with the zombie, explaining why eating human" << endl <<
                     "brains is wrong. He doesn't seem to care and tries to eat you." << endl <<
                     "You run away like a baby and hide in a dumpster until" << endl <<
                     "nightfall. When the coast seems clear, you climb out" << endl <<
                     "and start looking for a less smelly hiding place. There" << endl <<
                     "is an abandoned medical research facility up ahead. You" << endl <<
                     "think there might be a cure to the zombie plague inside.";	
                  cout << endl << endl << "** What would you like to do? **" << endl << endl <<
                     "* Choose 1 if you want to look for a cure." << endl <<
                     "* Choose 2 if you want to check the facility for zombies.";
               
                  break;
            
            }
         }
         else
         { 
            switch (menuchoice2)
            { 
               case 0 : cout << endl << "Zombie Town was created by Austin Dixon. It only recognizes numbers" << endl <<
                     "0-3, it doesn't understand words or symbols. On the plus side," << endl <<
                     "you never have to worry about this program eventually" << endl << "becoming skynet.";
               
                  break;
               case 1 : cout << endl << "You cant shoot the zombie, you didnt take the gun, remember?" << endl <<
                     "Instead you run away like a baby and hide in a dumpster until" << endl <<
                     "nightfall. When the coast seems clear, you climb out" << endl <<
                     "and start looking for a less smelly hiding place. There" << endl <<
                     "is an abandoned medical research facility up ahead. You" << endl <<
                     "think there might be a cure to the zombie plague inside.";
                  cout << endl << endl << "** What would you like to do? **" << endl << endl <<
                     "* Choose 1 if you want to look for a cure." << endl <<
                     "* Choose 2 if you want to check the facility for zombies.";
               
                  break;
               case 2 : cout << endl << "You run away like a baby and hide in a dumpster until" << endl <<
                     "nightfall. When the coast seems clear, you climb out" << endl <<
                     "and start looking for a less smelly hiding place. There" << endl <<
                     "is an abandoned medical research facility up ahead. You" << endl <<
                     "think there might be a cure to the zombie plague inside.";
                  cout << endl << endl << "** What would you like to do? **" << endl << endl <<
                     "* Choose 1 if you want to look for a cure." << endl <<
                     "* Choose 2 if you want to check the facility for zombies.";
               
                  break;     
               case 3 : cout << endl << "You try to reason with the zombie, explaining why eating" << endl <<
                     "human brains might be a bad idea. The zombie doesn't seem" << endl <<
                     "convinced. He eats you. You are dead." << endl << endl <<
                     "GAME OVER";
                  break;
            
            }
         }
      
      
         cin >> menuchoice3;   
      //-------------------------------------------------  
         if (menuchoice3<=2)      
         
            
         
      //------------------------------------------------
      
         switch (menuchoice3)
         { 
            case 0 : cout << endl << "Zombie Town was created by Austin Dixon. It only recognizes numbers" << endl <<
                  "0-3, it doesn't understand words or symbols. On the plus side," << endl <<
                  "you never have to worry about this program eventually" << endl << "becoming skynet.";
            
               break;
            case 1 : cout << endl << "You start searching the facility for a possible cure." << endl <<
                  "The building seems pretty ransacked, but there is one" << endl <<
                  "locked door. You wonder if there is a cure on the other side." << endl <<
                  "The door has a keypad lock, you will need the code to" << endl <<
                  "get in. There is a poster on the wall that reads you are" << endl <<
                  "the sum of your choices. Maybe thats a clue..."; 
               break;
            case 2 : cout << endl << "You search the building for zombies. In the distance" << endl <<
                  "you hear a rustling sound. Its coming from behind a locked" << endl <<
                  "door. The door has a keypad lock, you will need the code to" << endl <<
                  "get in. There is a poster on the wall that reads you are" << endl <<
                  "the sum of your choices. Maybe thats a clue..."; 
            
               break;
         
         }
      
    
         
         cin >> code;
         
         total=id+menuchoice+menuchoice2+menuchoice3;
      //-----------------------------------------
      
         if (code==total)
         {cout << endl << endl << "The code worked! As you open the door, a zombie lunges" << endl <<
               "out at you, knocking you to the floor. You hear a gunshot. The man" << endl <<
               "in camo is standing over you, his gun smoking. Forgot about him, didnt" << endl <<
               "you. You thank the man in camo for saving your life, and you both" << endl <<
               "enter the room. There on a table you see a vial of green liquid." << endl <<
               "A stack of papers next to the vial explains that this is" << endl <<
               "the cure you were looking for!" << endl << endl << 
         		"Congratulations, you just saved the world!!!" << endl << endl
                 ;
         		
         		
         }
         
         else 
         { cout << endl << endl << "That is not the right code. While you were messing" << endl <<
               "around on the computer, a zombie crept up behind" << endl <<
               "you and ate your brains. You are dead." << endl << endl <<
               "GAME OVER" << endl << endl
               ;
              
         }
      
      //-----------------------------------------
      cout << "Choose 1 to exit." << endl <<
              "Choose 2 to play again";
      
      cin >> exit;
      
      if (exit==1)
      {
      return (0);
      }
      
      else
      {
      ;
      }
      }
      }