-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (58 loc) · 2.22 KB
/
Copy pathmain.cpp
File metadata and controls
59 lines (58 loc) · 2.22 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
#include <iostream>
#include <cstdio>
#include <string>
#include <fstream>
#include <ctime>
#include "menu.h"
#include "startgame.h"
#include "interactive.h"
using namespace std;
int main(){
clear_screen();
for (int i=0;i<=screen_N+4;i++){
for (int j=0;j<=screen_M;j++){
putchar(' ');
}
putchar('\n');
}
clear_screen();
cout<<"PLAY FLAPPY BIRD!!!"<<endl;
cout<<"Welcome to Flappy Bird, this game is made by Jason Mak, Dacian Deng, Maggie Ke and Ruize Lai."<<endl;
cout<<"How to play: Just press SPACE to make the descending bird fly upwards and fly between columns of green obstacles without hitting them!"<<endl;
cout<<"\nIMPORTANT: please fullscreen your console";
wait_to_enter();
srand(time(0));
char option = '0';
string name;
while (option != 4){
print_menu();
option=keyboard_hit();
while (option=='\0'){
wait_to_next();
option=keyboard_hit();
}
switch (option){ //different options in menu
case '1':
int score;
score=startgame(); //start the game and the startgame() function returns a score
if (score==-1){
break;
}
else if (score==0){ //Not entering leaderboard
wait_to_enter();
break;
}
upd_ranking(score); //update ranking
break;
case '2':
showranking();
break;
case '3':
game_end();
break;
default: //If the input is invalid, players need to input again.
break;
}
}
return 0;
}