Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
C3-Game/map.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
193 lines (166 sloc)
4.95 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <iostream> | |
#include <string> | |
#include <cctype> | |
#include <vector> | |
#include <ctime> | |
#include <thread> | |
#include <chrono> | |
#include "npc.cpp" //uses functions from npc.cpp file | |
using namespace std; | |
int location; | |
void Streets1(); | |
void Streets2(); | |
void extZlabs(); | |
void Zlabs(); | |
void Streets1() | |
{ | |
location = 1; //gives each different location a number | |
int input; | |
cout << "You are in the Streets of London (West). " << endl; | |
cout << "You meet a random woman with a friendly smile." << endl; | |
npc(); //accesses an outside function here | |
cout << "0: Stay put. | 1: Travel to the east of the streets. " << endl; | |
while (true) //loop that will loop until the user types the correct command | |
{ | |
std::this_thread::sleep_for (std::chrono::seconds(1)); //sleeps the program to slow down output text | |
cout << "What will you do: "; | |
cin >> input; //recieves user input | |
if (input == 0) | |
{ | |
cout << "You decide to stay put and explore your current surroundings more. " << endl; | |
Streets1(); //will access stated function if option chosen | |
} | |
if (input == 1) | |
{ | |
cout << "You decide to travel to the east of the streets" << endl; | |
Streets2(); | |
} | |
if (input == -1) | |
{ | |
exit( 0); //will end the program | |
} | |
else | |
{ | |
cout << "Sorry that was not a recognised input. " << endl; //outputs when the user inputs something invalid | |
} | |
} | |
} | |
void Streets2() | |
{ | |
int input; | |
cout << "You are in the streets of the London (East). " << endl; | |
cout << "Nick's office is here. " << endl; | |
location = 2; | |
cout << "0: Stay put. | 1: Go to Nick's office. | 2: Travel to the west of the streets. | 3: Follow the street signs to 'Zada-Labs'. " << endl; | |
while (true) | |
{ | |
std::this_thread::sleep_for (std::chrono::seconds(1)); | |
cout << "What will you do: "; | |
cin >> input; | |
if (input == 0) | |
{ | |
cout << "You decide to stay put and explore your current surroundings more. " << endl; | |
Streets2(); | |
} | |
if (input == 1) | |
{ | |
cout << "You walk to Nick's office. " << endl; | |
cout << "He notices you through the windows and comes to talk to you. " << endl; | |
speech2(); | |
cout << "You leave Nick's office. " << endl; | |
Streets2(); | |
} | |
if (input == 2) | |
{ | |
cout << "You decide to travel to the west of the streets. " << endl; | |
Streets1(); | |
} | |
if (input == 3) | |
{ | |
cout << "You decide to follow the signs towards 'Zada-Labs'. " << endl; | |
extZlabs(); | |
} | |
if (input == -1) | |
{ | |
exit( 0); | |
} | |
else | |
{ | |
cout << "Sorry that was not a recognised input. " << endl; | |
} | |
} | |
} | |
void extZlabs() | |
{ | |
int input; | |
cout << "You are outside the intimidating Zada-Labs. " << endl; | |
cout << "There is a faint hum of machinary coming from the building" << endl; | |
location = 3; | |
cout << "0: Stay put. | 1: Travel to the west of the streets. | 2: Enter into 'Zada-Labs'. " << endl; | |
while (true) | |
{ | |
std::this_thread::sleep_for (std::chrono::seconds(1)); | |
cout << "What will you do: "; | |
cin >> input; | |
if (input == 0) | |
{ | |
cout << "You decide to stay put and explore your current surroundings more. " << endl; | |
extZlabs(); | |
} | |
if (input == 1) | |
{ | |
cout << "You decide to travel to the west of the streets. " << endl; | |
Streets2(); | |
} | |
if (input == 2) | |
{ | |
cout << "You decide to enter 'Zada-Labs'. " << endl; | |
Zlabs(); | |
} | |
if (input == -1) | |
{ | |
exit( 0); | |
} | |
else | |
{ | |
cout << "Sorry that was not a recognised input. " << endl; | |
} | |
} | |
} | |
void Zlabs() | |
{ | |
int input; | |
cout << "You are inside Zada-Labs. " << endl; | |
cout << "It is dark and a little too quiet... " << endl; | |
location = 4; | |
cout << "0: Stay put. | 1: Leave 'Zada-Labs'. " << endl; | |
while (true) | |
{ | |
std::this_thread::sleep_for (std::chrono::seconds(1)); | |
cout << "What will you do: "; | |
cin >> input; | |
if (input == 0) | |
{ | |
cout << "You decide to stay put and explore your current surroundings more. " << endl; | |
Zlabs(); | |
} | |
if (input == 1) | |
{ | |
cout << "You decide to leave 'Zada-Labs'. " << endl; | |
extZlabs(); | |
} | |
if (input == -1) | |
{ | |
exit( 0); | |
} | |
else | |
{ | |
cout << "Sorry that was not a recognised input. " << endl; | |
} | |
} | |
} | |
int main() | |
{ | |
Streets1(); | |
} | |