|
|
@ -71,3 +71,60 @@ int main()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//函数定义
|
|
|
|
|
|
|
|
void print()/*输出界面*/
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
system("color F5");
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
int i,j;
|
|
|
|
|
|
|
|
for(i=0;i<n;i++){
|
|
|
|
|
|
|
|
for(j=0;j<m;j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(map[i][j]==Road) printf(" "); /*1 路*/
|
|
|
|
|
|
|
|
else if(map[i][j]==Wall) printf("█");/*0 墙*/
|
|
|
|
|
|
|
|
else if(map[i][j]==Des) printf("◎");/*3 终点*/
|
|
|
|
|
|
|
|
else if(map[i][j]==Player) printf("◆");/*4 人物*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*控制移动*/
|
|
|
|
|
|
|
|
void up()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(map[x-1][y]==3) flag=2;
|
|
|
|
|
|
|
|
if(map[x-1][y]==1){
|
|
|
|
|
|
|
|
xy(x,y);
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
map[x-1][y]=4;
|
|
|
|
|
|
|
|
map[x][y]=1;
|
|
|
|
|
|
|
|
x--;
|
|
|
|
|
|
|
|
coord.Y--; xy();
|
|
|
|
|
|
|
|
printf("◆");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void down()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(map[x+1][y]==3) flag=2;
|
|
|
|
|
|
|
|
if(map[x+1][y]==1){
|
|
|
|
|
|
|
|
xy(x,y);
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
map[x+1][y]=4;
|
|
|
|
|
|
|
|
map[x][y]=1;
|
|
|
|
|
|
|
|
x++;
|
|
|
|
|
|
|
|
coord.Y++; xy();
|
|
|
|
|
|
|
|
printf("◆");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void right()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(map[x][y+1]==3) flag=2;
|
|
|
|
|
|
|
|
if(map[x][y+1]==1){
|
|
|
|
|
|
|
|
xy(x,y);
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
map[x][y+1]=4;
|
|
|
|
|
|
|
|
map[x][y]=1;
|
|
|
|
|
|
|
|
y++;
|
|
|
|
|
|
|
|
coord.X+=2; xy();
|
|
|
|
|
|
|
|
printf("◆");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|