diff --git a/迷宫游戏.cpp b/迷宫游戏.cpp new file mode 100644 index 0000000..bd12f9f --- /dev/null +++ b/迷宫游戏.cpp @@ -0,0 +1,349 @@ +#include +#include +#include +#include +#include +#define Height 25 //Թĸ߶ȣΪ +#define Width 25 //ԹĿȣΪ +#define Wall 1 +#define Road 0 +#define Start 2 +#define End 3 +#define Esc 5 +#define Up 1 +#define Down 2 +#define Left 3 +#define Right 4 +#define TS 6 +#define N1 532 +#define N2 588 +#define N3 660 +#define N4 698 +#define N5 784 +#define N6 880 +#define N7 988 +#define C 400 //һ +#define D 200 +#define E 100 +int map[Height+2][Width+2]; +void sung() + { + Beep(N1,C);Beep(N1,C);Beep(N5,C);Beep(N5,C);Beep(N6,C);Beep(N6,C);Beep(N5,C);Beep(0,C); + Beep(N4,C);Beep(N4,C);Beep(N3,C);Beep(N3,C);Beep(N2,C);Beep(N2,C);Beep(N1,C);Beep(0,C); + Beep(N5,C);Beep(N5,C);Beep(N4,C);Beep(N4,C);Beep(N3,C);Beep(N3,C);Beep(N2,C);Beep(0,C); + Beep(N5,C);Beep(N5,C);Beep(N4,C);Beep(N4,C);Beep(N3,C);Beep(N3,C);Beep(N2,C);Beep(0,C); + Beep(N1,C);Beep(N1,C);Beep(N5,C);Beep(N5,C);Beep(N6,C);Beep(N6,C);Beep(N5,C);Beep(0,C); + Beep(N4,C);Beep(N4,C);Beep(N3,C);Beep(N3,C);Beep(N2,C);Beep(N2,C);Beep(N1,C);Beep(0,C); //С + Beep(N5,C);Beep(N4,C);Beep(N3,C);Beep(0,C);Beep(N3,C);Beep(N4,C);Beep(N3,C);Beep(0,C); + Beep(N3,C);Beep(N4,C);Beep(N3,C);Beep(N4,C);Beep(N3,C);Beep(N2,C);Beep(N1,C);Beep(0,C); + Beep(N1,C);Beep(N3,C);Beep(N5,C);Beep(N6,C);Beep(0,C);Beep(N6,C);Beep(N6,C);Beep(N5,C);Beep(N2,C);Beep(N2,C);Beep(N4,C);Beep(N3,C);Beep(0,C); +} +void gotoxy(int x,int y) //ƶ +{ + COORD coord; + coord.X=x; + coord.Y=y; + SetConsoleCursorPosition( GetStdHandle( STD_OUTPUT_HANDLE ), coord ); +} +void hidden()//ع +{ + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_CURSOR_INFO cci; + GetConsoleCursorInfo(hOut,&cci); + cci.bVisible=0;//1Ϊʾ0Ϊ + SetConsoleCursorInfo(hOut,&cci); +} +int color(int c) +{ + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),c);//ɫ + return 0; +} +void welcome(); +void yxjm(); +void game(); +//ɽ +void title() +{ + color(14); + gotoxy(30,7); + printf("ӭ"); + color(5); + gotoxy(36,8); + printf("ԹϷ"); + color(12); + printf("