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?
Text-Based-game/Text based - lukes other code/intro.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
51 lines (41 sloc)
1.76 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 <iostream> | |
#include <string> //add strings to the code | |
#include <stdlib.h> // this and time.h and windows.h controls the speed of the printing of epilogue | |
#include <time.h> | |
#include <windows.h> | |
using namespace std; | |
int main() // main function | |
{ | |
char epilogue[] = "Hello, and welcome to the game\n" | |
"--------------COWBOYS AND ALIENS--------------\n" | |
"In this beautiful world in the 1870's, you a young cowboy travelling around the country gunslinging and all are faced with an opponent your brain cannot comprehend.\n" | |
"Aliens..." | |
"Your mission is to kill all of the aliens and take out their leader before they destroy the west.\n""AND THE WORLD.\n"; // introduction epilogue. | |
for (int n = 0; n < sizeof(epilogue); n++) // this makes the epilogue appear letter by letter. | |
{ | |
cout << epilogue[n]; | |
Sleep(100); //controls the speed that the epilogue letters print. | |
// https://www.youtube.com/watch?v=TZ8LMeo99LI&t=523s - used speed of printing | |
} | |
int i = 1; | |
while (i<2) | |
{ | |
cout << "so . . . will you defend earth?\n"; | |
Sleep (100); | |
string choice; // choice string created. | |
cin >> choice; | |
if (choice == "yes" || choice == "yeah" || choice == "ok") // if choice is one of these it will respond. | |
{ | |
cout << "ahh good, lets get this going then.\n"; | |
} | |
else if (choice == "no") // else if statement for when input is no. | |
{ | |
cout << "well that is really a shame, guess we'll just hope the world doesnt end . . . \n" | |
"press any key and enter to escape. \n"; | |
} | |
else | |
{ | |
return 0; | |
} | |
} | |
} | |