You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<windows.h>
//变量声明
#define M 100
#define N 100
#define Road 1
#define Wall 0
#define Des 3
#define Player 4
//定义光标位置
COORD coord; /*光标地址变量*/
short map[N][M];/*地图 */
int x,y;/*人物坐标 */
int m=21,n=21;/*实际地图大小 */
int flag; /*
控制界面切换
0主菜单
1游戏界面
2结束游戏
3退出游戏
*/
//函数声明
void mune();
void print();
void Print(char);
void up();
void down();
void right();
void left();
void gotc();
void Map_1();
void xy();
void HideCursor();
void chu();
char des(int,int);
void dig(char,int,int);
void make(int,int);
void CreateMaze();
void win();
void end();
//主函数
int main()
{
HideCursor();
system("title 迷宫游戏");
flag=0;
while(1){
if(flag==0) mune();
if(flag==1){
coord.X = 2;
coord.Y = 1;
xy(); //将屏幕指针位置移向初始位置
if(n==21) system("mode con cols=42 lines=22");
else if(n==31) system("mode con cols=62 lines=32");
else if(n==41) system("mode con cols=82 lines=42");
print(n,m);
gotc();
}
if(flag==2){
win();
flag=0;
}
if(flag==3){
end();
break;
}
}
return 0;
}