forked from benwu030/Text_based_game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain_Menu.cpp
143 lines (120 loc) · 10.1 KB
/
Main_Menu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//Main_Menu.cpp
//Program Description: This program contains functions that are in charge of giving visual effects at some important changing scene
//Such as opening, victory, loss
#include<iostream>
#include <unistd.h>
#include<string>
#include <stdio.h>
#include "readfile.h"
#include "Map.h"
#include "ItemAndMonster.h"
using namespace std;
//This function is called out when the game starts to welcome player
void print_MainMenu(){
cout<<"████████╗██╗ ██╗███████╗ ██╗ █████╗ ███████╗████████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗"<<endl;
cout<<"╚══██╔══╝██║ ██║██╔════╝ ██║ ██╔══██╗██╔════╝╚══██╔══╝ ██║ ██║██╔═══██╗██╔══██╗██╔════╝"<<endl;
cout<<" ██║ ███████║█████╗ ██║ ███████║███████╗ ██║ ███████║██║ ██║██████╔╝█████╗"<<endl;
cout<<" ██║ ██╔══██║██╔══╝ ██║ ██╔══██║╚════██║ ██║ ██╔══██║██║ ██║██╔═══╝ ██╔══╝"<<endl;
cout<<" ██║ ██║ ██║███████╗ ███████╗██║ ██║███████║ ██║ ██║ ██║╚██████╔╝██║ ███████╗"<<endl;
cout<<" ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝"<<endl<<endl;
cout<<" ***";
cout<<"Main Menu";
cout<<"*** "<<endl;
cout<<" 1) Start A New Game "<<endl;
cout<<" 2) Resume Last Saving "<<endl;
cout<<" 3) HELP "<<endl;
cout<<" 4) Exit "<<endl;
}
//This function is called out when the player wins the game and successfully rescue his daughter
void print_Victory(){
cout << "░█████╗░░█████╗░███╗░░██╗░██████╗░██████╗░░█████╗░████████╗░██████╗██╗" << endl;
cout << "██╔══██╗██╔══██╗████╗░██║██╔════╝░██╔══██╗██╔══██╗╚══██╔══╝██╔════╝██║" << endl;
cout << "██║░░╚═╝██║░░██║██╔██╗██║██║░░██╗░██████╔╝███████║░░░██║░░░╚█████╗░██║" << endl;
cout << "██║░░██╗██║░░██║██║╚████║██║░░╚██╗██╔══██╗██╔══██║░░░██║░░░░╚═══██╗╚═╝" << endl;
cout << "╚█████╔╝╚█████╔╝██║░╚███║╚██████╔╝██║░░██║██║░░██║░░░██║░░░██████╔╝██╗" << endl;
cout << "░╚════╝░░╚════╝░╚═╝░░╚══╝░╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░╚═════╝░╚═╝" << endl;
cout<<"You have successfully rescued your daugher!!!"<<endl;
}
//This function is called when the health of player is less than zero and the player dies
//Wich means the player has lost the game and failed to rescue his daughter
void print_Lose(){
cout << "██╗░░░██╗░█████╗░██╗░░░██╗ ░█████╗░██████╗░███████╗ ██████╗░███████╗░█████╗░██████╗░██╗" << endl;
cout << "╚██╗░██╔╝██╔══██╗██║░░░██║ ██╔══██╗██╔══██╗██╔════╝ ██╔══██╗██╔════╝██╔══██╗██╔══██╗██║" << endl;
cout << "░╚████╔╝░██║░░██║██║░░░██║ ███████║██████╔╝█████╗░░ ██║░░██║█████╗░░███████║██║░░██║██║" << endl;
cout << "░░╚██╔╝░░██║░░██║██║░░░██║ ██╔══██║██╔══██╗██╔══╝░░ ██║░░██║██╔══╝░░██╔══██║██║░░██║╚═╝" << endl;
cout << "░░░██║░░░╚█████╔╝╚██████╔╝ ██║░░██║██║░░██║███████╗ ██████╔╝███████╗██║░░██║██████╔╝██╗" << endl;
cout << "░░░╚═╝░░░░╚════╝░░╚═════╝░ ╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝ ╚═════╝░╚══════╝╚═╝░░╚═╝╚═════╝░╚═╝" << endl;
}
//This function is to take input from player at the Main Menu page
//choice is input from player
//choice 1 start a new game 2 load past saving 3 help 4 exit
bool MainMenu_Choice(string choice,string Map[],Main_character &Chris){
if (choice.length()!=1){
cout << "Invalid input, please input again" << endl;
return false;
}
else{
char option = choice[0];
switch(option) {
case '1': //Case 1 is for player first time playing this game to create a new game
Create_NewMap(Map);
Create_NewChararcter(Chris);
Current_At_Entrance(Map);
system("clear");
//Story and Background Description
cout << "===========================================================================\n";
cout << "| _[]_ |\n";
cout << "| _______________|[][]|____ |\n";
cout << "| |[][]|[][]|[][]|[][]|[][]|_____ |\n";
cout << "| | /\\|/\\ | /\\| /\\|/\\ |_____\\ |\n";
cout << "| |[]|||||[]|[]|||[]|||||[]|[_]||| |\n";
cout << "| ====================================== |\n";
cout << "| - - - - - - - - - - - - - |\n";
cout << "|========================================= |\n";
cout << "===========================================================================\n";
cout << "===================================================================================================="<<endl;
cout << "Story :"<<endl;
cout << "You are "; cout << "Chris"; cout << ", a former police. Your daughter "; cout <<"Alexandra"; cout << " has been abducted by unknown." << endl;
cout << "You have searched her for 2 years and now all clues pointed to this corp";cout << "- BioReincarnation(Bior.)" << endl;
cout << "Alexandra is said to be imprisoned in a lab inside an obsolete building." << endl;
cout << "You are standing in front of the main entrance of the building. " << endl;
cout << "===================================================================================================="<<endl;
cout.flush(); sleep(10);
system("clear");
Display_Lab_Map(Map);
cout << "===================================================================================================="<<endl;
cout << "This is the map of the building." << endl;
cout << "You are at the \"Entrance\" now."<< endl;
cout << "The door is locked right after you enter the Entrance" << endl;
cout << "You have to play a very very very difficult TicTaeToe game to open the door." << endl;
cout << "You might find something useful to"; cout << " lower the difficulty";cout << "of the tictaetoe but I can't guarantee you." << endl;
cout << "Tips: Items like potions and grenades are consumable and can be actively used by you." << endl;
cout << "While Equipments like armour and guns are equiped by you immediately after you have gotten it" << endl;
cout << "and it will increase your attributes automatically and immediately."<< endl;
cout << "Your game progress is automatically saved if you have successfully defeated a villain in a new location :)" << endl;
cout << "===================================================================================================="<<endl;
cout.flush(); sleep(10);
system("clear");
break;
case '2': //Case 2 is to load the player's last saved game progress/profile so that player can continue his unfinished gameplay
cout << "Resume from last save" << endl;
load_Map(Map);
load_MainCharacter(Chris);
SetItemAndEquiment(Chris);
cout << "Game loaded" << endl;
usleep(1000);
system("clear");
break;
case '3':
cout << "help" << endl;
break;
case '4':
cout << "exit" << endl;
break;
default:
cout << "Invalid input, please input again" << endl;
return false;
}
return true;
}
}