-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
98 lines (96 loc) · 3.33 KB
/
main.cpp
File metadata and controls
98 lines (96 loc) · 3.33 KB
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
#include <graphics.h>
#include "filehandling.cpp"
#include "menus.cpp"
#include "gameplay.cpp"
using namespace std;
int main()
{
string username;
string menu1[] = {" Create New Profile ", " Load Profile ", " Quit "};
string menu2[] = {" Resume Game ", " Start New Game ", " How To Play ", " Choose Difficulty ", " View HighScores ", " Return To Profile Menu ", " Quit Game "};
string menu3[] = {" Continue To Next Level ", " Return To Main Menu ", " Quit Game "};
string menu4[] = {" Easy ", " Medium ", " Hard ", " Go Back "};
int choice, new_game, difficulty;
bool game_on = true;
while (game_on)
{
username = "";
difficulty = 0; // default easy
choice = menu("B R I C K || B R E A K E R", menu1, 3, RED);
if (choice == 0 || choice == 1)
{
if (myProfile(username, choice))
{
while (game_on)
{
new_game = loadstate(username);
if (new_game)
{
// show newgame option
choice = menu("M A I N || M E N U", menu2, 7, RED, 1);
}
else
{
// show resume + newgame option
choice = menu("M A I N || M E N U", menu2, 7, RED);
}
if (choice == 0 || choice == 1)
{
// Start new game
if (choice == 1)
{
new_game = 1;
}
while (gameLoop(username, new_game, difficulty))
{
// New random level
choice = menu("!! L E V E L C L E A R E D !!", menu3, 3, LIGHTGREEN);
if (choice == 1)
{
break;
}
else if (choice == 2)
{
game_on = false;
break;
}
}
}
// instructions
else if (choice == 2)
{
howToPlay();
}
// change in-game difficulty
else if (choice == 3)
{
// Difficulty menu
choice = menu(" S E T || D I F F I C U L T Y ( " + menu4[difficulty] + " )", menu4, 4, BROWN);
if (choice < 3)
{
difficulty = choice;
}
}
// view highscores of all players
else if (choice == 4)
{
viewHighScores();
}
else if (choice == 5)
{
break;
}
else
{
game_on = false;
}
}
}
}
else
{
game_on = false;
}
}
return 0;
}