C++#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
using namespace std;
struct xg
{
int xgx,xgy;
bool fx,sw=0;
} xg[21];
int ys=0,hd=0,sj=0,sl=0,mg=0,hp=0,hss=0,hsx=0,jt=0,s=0;
char ch[35][35]={
"",
" ##### ##### ########",
" #&## ### ### ",
" #### # ## #### #### ",
" ### ## # ####! ## ",
" ###& ### +## ###### ####",
" ######&############! ##",
" # *# ! ######### ###-##",
" # ### ##### # ",
" # ###*# ############### ### ",
" # ###&### ####",
" # # # ##-############## ",
" ###### #####! ",
" #+ # ###### ############ ",
" ##&########## ### ### ### ## ",
" # ! ! #",
" ############################",
" # ! # ! # #",
" # ! # ! #### ",
" &############################ ",
" O ",};
char ch2[35][35]={
"",
" ############################# ",
" #* ",
" ########&####################-",
" # # ",
" # # #####################&#-# ",
" # # # +# # ",
" # # # ##&################ # # ",
" # # # # # # # ",
" # # # # #&############# # # # ",
" # # # # #O! # # # # ",
" # # # # # ? ! # # # ",
" # # # # ################# # # ",
" # # # ! ! # ",
" # # ######################### ",
" # # ! ! *# ",
" # ########### ############# # ",
" # # ! # # ! # ",
" # ############# ############ ",
" # ! ! #",
" ##############################", };
char ch3[31][33]={
"",
" ##############################",
" #. .#",
" # #",
" # #",
" # #",
" # #",
" # #",
" # #",
" # #",
" # #",
" # #",
" # #",
" # _____ #",
" # |_ _| #",
" # |_| |_| #",
" # |MMMMM| #",
" # |WWWWW| #",
" # |_____| #",
" # #",
" #. .#",
" ##############################", };
char ch4[35][35]={
"",
" ###*### ######+#",
" ###! # ##### # #",
" ###&#*####### # # # # ######",
" # !# # #-# # # # #",
" ###&####### # # # # ## #",
" ####### ##### # ## #",
" ####&### ! !!!!# ## #",
" # ################ ## #",
" ### !! ## #",
" #### ##&################### #",
" #! !##",
" #-############&######### #####",
" #-#ooooooooooo o # #####",
" o ooo o o o o ooo # #####",
" o o o o oo o o # *#",
" ooo o ooooooo oo ooo o #######",
" ooo o o o oo o #",
" ooo o o o*oooooooooooooooo-#",
" ooooooo o oo o o o o #",
" O o o o o o #",
};
char ch5[35][35]={
"",
" oooo oooooooooooooooooooo",
" ooo o o o o o",
" ooooooo*oooo o o o o o o o o o",
" o o o o o o o",
" oooooooooo ooooooooooooooooo o",
" o o",
" oooooooo ooooooooooooooooooooo",
" oooooooo ooooooooooooooooooooo",
" o o",
" o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o",
" o o",
" o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o",
" o^*^ ^ ^ ^ ^ ^^^^ ^ ^ ^ ^ ^*^o",
" o^^^^^^^^^^^^^^^^^^^^^^^^^^^^o",
" o o",
" #^^^^^^^^^^^^^^^^^^^^^^^^^^^^#",
" # #",
" ####oooooooooo--oooooooooooo##",
" ########oooooo--ooooooo#######",
" ###########oooOOoooo##########",
};
char ch6[35][35]={
"",
" oooooooooooooo .ooooooooooooooo",
" oooooooooooooo oooooooooooooo",
" ooooooooooooo# #ooooooooooooo",
" oooooooooooo#^^^^#oooooooooooo",
" ooooooooooo#^ ^#ooooooooooo",
" oooooooooo# ^ ^ #oooooooooo",
" ooooooooo# ^ ^ #ooooooooo",
" oooooooo#^^^^^^^^^^^^#oooooooo",
" ooooooo#^ ^#--#^ ^#ooooooo",
" . ^ ^|NO|^ ^ ",
" ^ ^|IP|^ ^ .",
" ooooooo#^ ^#--#^ ^#ooooooo",
" oooooooo#^^^^^^^^^^^^#oooooooo",
" ooooooooo# ^ ^ #ooooooooo",
" oooooooooo# ^ ^ #oooooooooo",
" ooooooooooo#^ ^#ooooooooooo",
" oooooooooooo#^^^^#oooooooooooo",
" ooooooooooooo# #ooooooooooooo",
" oooooooooooooo oooooooooooooo",
" oooooooooooooo. oooooooooooooo",};
int yx6()
{
sj=0;
int x=1,y=15;
system("cls");
while (1)
{
for (int i=1;i<=20;++i)
{
int xx=rand()%21,yy=rand()%31;
if (ch6[xx][yy]!='^'&&ch6[xx][yy]!='.'&&ch6[xx][yy]!='-'&&ch6[xx][yy]!='|'&&ch6[xx][yy]!='o'&&ch6[xx][yy]!='#'&&ch6[xx][yy]!='N'&&ch6[xx][yy]!='O'&&ch6[xx][yy]!='I'&&ch6[xx][yy]!='P') ch6[xx][yy]='!';
}
s++;
for (int i=1;i<=20;++i)
{
for (int j=1;j<=30;++j)
{
bool f=1;
if (f==1)
if (i==x&&j==y) cout<<' '<<'@';
else if (ch6[i][j]=='#') cout<<' '<<'#';
else if (ch6[i][j]=='!') cout<<' '<<'!';
else if (ch6[i][j]=='*') cout<<' '<<'*';
else if (ch6[i][j]=='-') cout<<' '<<'-';
else if (ch6[i][j]=='o') cout<<' '<<'o';
else if (ch6[i][j]=='N') cout<<' '<<'N';
else if (ch6[i][j]=='O') cout<<' '<<'O';
else if (ch6[i][j]=='I') cout<<' '<<'I';
else if (ch6[i][j]=='P') cout<<' '<<'P';
else if (ch6[i][j]=='|') cout<<' '<<'|';
else if (ch6[i][j]=='.') cout<<' '<<'.';
else if (ch6[i][j]=='^'&&s%3==0) cout<<' '<<'^';
else if (ch6[i][j]=='^') cout<<' '<<'_';
else cout<<' '<<' ';
}
cout<<i<<endl;
}
for (int i=1;i<=30;++i) if (i<=9) cout<<' '<<i;else cout<<i;
cout<<endl;
if (ch6[x][y]=='^'&&s%3==0&&hd==0) {system("cls");cout<<"Game Over!";Sleep(5000);return 0;}
else if (hd>0&&ch6[x][y]=='^'&&s%3==0) {system("cls");cout<<"护盾保护了你!";hd--;Sleep(3000);system("cls");}
char c;
c=getch();
if (c=='w'&&x!=1&&ch6[x-1][y]!='#')x-=1;
else if (c=='s'&&x!=20&&ch6[x+1][y]!='#')x+=1;
else if (c=='a'&&y!=1&&ch6[x][y-1]!='#')y-=1;
else if (c=='d'&&y!=30&&ch6[x][y+1]!='#')y+=1;
system("cls");
if(ch6[x][y]=='o') {cout<<"Game Over!";Sleep(5000);system("cls");return 0;}
if (ch6[x][y]=='.') {cout<<"破坏了水晶!";Sleep(3000);sj++;system("cls");if (sj==4){cout<<"You Win!";Sleep(5000);jt=1;sj=0;system("cls");return 0;}}
if (ch6[x][y]=='*') {cout<<"找到了钥匙!";ys++;Sleep(3000);system("cls");ch6[x][y]=' ';}
if (ch6[x][y]=='-'&&ys>0) {cout<<"门开了!";ys--;Sleep(3000);system("cls");ch6[x][y]=' ';}
else if (ch6[x][y]=='-') {cout<<"没有钥匙!";--x;Sleep(3000);system("cls");}
if (ch6[x][y]=='+') {cout<<"找到了护盾!";hd++;Sleep(3000);system("cls");ch6[x][y]=' ';}
if (ch6[x][y]=='^'&&s%3==0&&hd==0) {system("cls");cout<<"Game Over!";Sleep(5000);return 0;}
else if (hd>0&&ch6[x][y]=='^'&&s%3==0) {system("cls");cout<<"护盾保护了你!";hd--;Sleep(3000);system("cls");}
for (int i=1;i<=20;++i)
for (int j=1;j<=30;++j)
if (ch6[i][j]=='!')
{
ch6[i][j]=' ';
for (int x1=i-1;x1<=i+1;++x1)
for (int y1=j-1;y1<=j+1;++y1)
if (x==x1&&y==y1){system("cls");cout<<"Game Over!";Sleep(5000);system("cls");return 0;}
}
}
}
int yx5()
{
int x=1,y=1;
system("cls");
while (1)
{
for (int i=1;i<=60;++i)
{
int xx=rand()%21,yy=rand()%31;
if (ch5[xx][yy]!='^'&&ch5[xx][yy]!='*'&&ch5[xx][yy]!='-'&&ch5[xx][yy]!='O'&&ch5[xx][yy]!='o'&&ch5[xx][yy]!='#') ch5[xx][yy]=',';
}
s++;
for (int i=1;i<=20;++i)
{
for (int j=1;j<=30;++j)
{
bool f=1;
if (f==1)
if (i==x&&j==y) cout<<' '<<'@';
else if (ch5[i][j]=='#') cout<<' '<<'#';
else if (ch5[i][j]=='O') cout<<' '<<'O';
else if (ch5[i][j]=='*') cout<<' '<<'*';
else if (ch5[i][j]=='-') cout<<' '<<'-';
else if (ch5[i][j]=='&') cout<<' '<<'#';
else if (ch5[i][j]=='o'||ch5[i][j]==',') cout<<' '<<'o';
else if (ch5[i][j]=='^'&&s%3==0) cout<<' '<<'^';
else if (ch5[i][j]=='^') cout<<' '<<'_';
else cout<<' '<<' ';
}
cout<<i<<endl;
}
for (int i=1;i<=30;++i) if (i<=9) cout<<' '<<i;else cout<<i;
cout<<endl;
if (ch5[x][y]=='^'&&s%3==0&&hd==0) {system("cls");cout<<"Game Over!";Sleep(5000);return 0;}
else if (hd>0&&ch5[x][y]=='^'&&s%3==0) {system("cls");cout<<"护盾保护了你!";hd--;Sleep(3000);system("cls");}
char c;
c=getch();
if (c=='w'&&x!=1&&ch5[x-1][y]!='#')x-=1;
else if (c=='s'&&x!=20&&ch5[x+1][y]!='#')x+=1;
else if (c=='a'&&y!=1&&ch5[x][y-1]!='#')y-=1;
else if (c=='d'&&y!=30&&ch5[x][y+1]!='#')y+=1;
system("cls");
if(ch5[x][y]=='o'||ch5[x][y]==',') {cout<<"Game Over!";Sleep(5000);system("cls");return 0;}
if (ch5[x][y]=='O') {cout<<"You Win!";Sleep(5000);hsx=1;return 0;}
if (ch5[x][y]=='*') {cout<<"找到了钥匙!";ys++;Sleep(3000);system("cls");ch5[x][y]=' ';}
if (ch5[x][y]=='-'&&ys>0) {cout<<"门开了!";ys--;Sleep(3000);system("cls");ch5[x][y]=' ';}
else if (ch5[x][y]=='-') {cout<<"没有钥匙!";--x;Sleep(3000);system("cls");}
if (ch5[x][y]=='+') {cout<<"找到了护盾!";hd++;Sleep(3000);system("cls");ch5[x][y]=' ';}
if (ch5[x][y]=='^'&&s%3==0&&hd==0) {system("cls");cout<<"Game Over!";Sleep(5000);return 0;}
else if (hd>0&&ch5[x][y]=='^'&&s%3==0) {system("cls");cout<<"护盾保护了你!";hd--;Sleep(3000);system("cls");}
for (int i=1;i<=20;++i)
for (int j=1;j<=30;++j)
if (ch5[i][j]==',') ch5[i][j]=' ';
}
}
int yx4()
{
int x=1,y=1;
system("cls");
for (int i=1;i<=12;++i)
xg[i].fx=0;
xg[1].xgx=2,xg[1].xgy=8;
xg[2].xgx=4,xg[2].xgy=12;
xg[3].xgx=7,xg[3].xgy=21;
xg[4].xgx=7,xg[4].xgy=22;
xg[5].xgx=7,xg[5].xgy=23;
xg[6].xgx=7,xg[6].xgy=24;
xg[7].xgx=9,xg[7].xgy=20;
xg[8].xgx=9,xg[8].xgy=21;
xg[9].xgx=11,xg[9].xgy=29;
xg[10].xgx=11,xg[10].xgy=2;
xg[11].xgx=7,xg[11].xgy=16;
while (1)
{
for (int i=1;i<=20;++i)
{
for (int j=1;j<=30;++j)
{
bool f=1;
for (int l=1;l<=10;++l)
if (xg[l].xgx==i&&xg[l].xgy==j&&xg[l].sw==0) {cout<<' '<<'!';f=0;break;}
if (f==1)
if (i==x&&j==y) cout<<' '<<'@';
else if (ch4[i][j]=='#') cout<<' '<<'#';
else if (ch4[i][j]=='O') cout<<' '<<'O';
else if (ch4[i][j]=='*') cout<<' '<<'*';
else if (ch4[i][j]=='-') cout<<' '<<'-';
else if (ch4[i][j]=='+') cout<<' '<<'+';
else if (ch4[i][j]=='&') cout<<' '<<'#';
else if (ch4[i][j]=='o') cout<<' '<<'o';
else cout<<' '<<' ';
}
cout<<i<<endl;
}
for (int i=1;i<=30;++i) if (i<=9) cout<<' '<<i;else cout<<i;
cout<<endl;
for (int i=1;i<=11;++i)
if (xg[i].fx==0&&ch4[xg[i].xgx][xg[i].xgy+1]!='#') xg[i].xgy++;
else if (xg[i].fx==1&&ch4[xg[i].xgx][xg[i].xgy-1]!='#') xg[i].xgy--;
else if (xg[i].fx==1) xg[i].fx=0;
else xg[i].fx=1;
for (int i=1;i<=11;++i)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"Game Over!";Sleep(5000);return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0)
{system("cls");cout<<"护盾保护了你!";Sleep(3000);system("cls");
cout<<endl;hd--;xg[i].sw=1;}
char c;
c=getch();
if (c=='w'&&x!=1&&ch4[x-1][y]!='#')x-=1;
else if (c=='s'&&x!=20&&ch4[x+1][y]!='#')x+=1;
else if (c=='a'&&y!=1&&ch4[x][y-1]!='#')y-=1;
else if (c=='d'&&y!=30&&ch4[x][y+1]!='#')y+=1;
system("cls");
if(ch4[x][y]=='o') {cout<<"Game Over!";Sleep(5000);system("cls");return 0;}
if (ch4[x][y]=='O') {cout<<"You Win!";Sleep(5000);hss=1;return 0;}
if (ch4[x][y]=='*') {cout<<"找到了钥匙!";ys++;Sleep(3000);system("cls");ch4[x][y]=' ';}
if (ch4[x][y]=='-'&&ys>0) {cout<<"门开了!";ys--;Sleep(3000);system("cls");ch4[x][y]=' ';}
else if (ch4[x][y]=='-') {cout<<"没有钥匙!";--x;Sleep(3000);system("cls");}
if (ch4[x][y]=='+') {cout<<"找到了护盾!";hd++;Sleep(3000);system("cls");ch4[x][y]=' ';}
for (int i=1;i<=11;++i)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"Game Over!";system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(3000);system("cls");hd--;xg[i].sw=1;}
}
}
int yx3()
{
int x=2,y=2;
system("cls");
while (1)
{
for (int i=1;i<=300;++i)
{
int xx=rand()%21,yy=rand()%31;
if (ch3[xx][yy]!='_'&&ch3[xx][yy]!='W'&&ch3[xx][yy]!='|'&&ch3[xx][yy]!='M'&&ch3[xx][yy]!='.') ch3[xx][yy]='o';
}
for (int i=1;i<=20;++i)
{
for (int j=1;j<=30;++j)
{
if (i==x&&j==y) cout<<' '<<'@';
else if (ch3[i][j]=='#') cout<<' '<<'#';
else if (ch3[i][j]=='O') cout<<' '<<'O';
else if (ch3[i][j]=='*') cout<<' '<<'*';
else if (ch3[i][j]=='-') cout<<' '<<'-';
else if (ch3[i][j]=='+') cout<<' '<<'+';
else if (ch3[i][j]=='&') cout<<' '<<'#';
else if (ch3[i][j]=='.') cout<<' '<<'.';
else if (ch3[i][j]=='o') cout<<' '<<'o';
else if (ch3[i][j]=='_') cout<<'_'<<'_';
else if (ch3[i][j]=='|') cout<<' '<<'|';
else if (ch3[i][j]=='M') cout<<'M'<<'M';
else if (ch3[i][j]=='W') cout<<'W'<<'W';
else cout<<' '<<' ';
}
cout<<i<<endl;
}
for (int i=1;i<=30;++i) if (i<=9) cout<<' '<<i;else cout<<i;
cout<<endl;
char c;
c=getch();
if (c=='w'&&x!=1&&ch3[x-1][y]!='#')x-=1;
else if (c=='s'&&x!=20&&ch3[x+1][y]!='#')x+=1;
else if (c=='a'&&y!=1&&ch3[x][y-1]!='#')y-=1;
else if (c=='d'&&y!=30&&ch3[x][y+1]!='#')y+=1;
system("cls");
if (ch3[x][y]=='_'||ch3[x][y]=='W'||ch3[x][y]=='|'||ch3[x][y]=='M'||ch3[x][y]=='o') {cout<<"Game over!";Sleep(5000);system("cls");return 0;}
if (ch3[x][y]=='.') {system("cls");cout<<"破坏了水晶!";ch3[x][y]=' ';Sleep(3000);system("cls");sj++;if (sj==4) {system("cls");cout<<"You Win!";Sleep(5000);system("cls");hp=1;sj=0;return 0;}}
if (ch3[x][y]=='*') {cout<<"找到了钥匙!";ys++;Sleep(3000);system("cls");ch3[x][y]=' ';}
if (ch3[x][y]=='-'&&ys>0) {cout<<"门开了!";ys--;Sleep(3000);system("cls");if (x==3&&y==30) ch3[3][30]=' ';else ch3[5][28]=' ';}
else if (ch3[x][y]=='-') {cout<<"没有钥匙!";--x;Sleep(3000);system("cls");}
if (ch3[x][y]=='+') {cout<<"找到了护盾!";hd++;Sleep(3000);system("cls");ch3[x][y]=' ';}
for (int i=1;i<=20;++i)
for (int j=1;j<=30;++j)
if (ch3[i][j]=='o') ch3[i][j]=' ';
}
}
int yx2()
{
int x=1,y=30;
system("cls");
for (int i=1;i<=12;++i)
xg[i].fx=0;
xg[1].xgx=10,xg[1].xgy=11;
xg[2].xgx=11,xg[2].xgy=21;
xg[3].xgx=13,xg[3].xgy=11;
xg[4].xgx=13,xg[4].xgy=21;
xg[5].xgx=15,xg[5].xgy=11;
xg[6].xgx=15,xg[6].xgy=21;
xg[7].xgx=17,xg[7].xgy=11;
xg[8].xgx=17,xg[8].xgy=21;
xg[9].xgx=19,xg[9].xgy=11;
xg[10].xgx=19,xg[10].xgy=21;
xg[11].xgx=10,xg[12].xgy=13;
while (1)
{
for (int i=1;i<=20;++i)
{
for (int j=1;j<=30;++j)
{
bool f=1;
for (int l=1;l<=10;++l)
if (xg[l].xgx==i&&xg[l].xgy==j&&xg[l].sw==0) {cout<<' '<<'!';f=0;break;}
if (f==1)
if (i==x&&j==y) cout<<' '<<'@';
else if (ch2[i][j]=='#') cout<<' '<<'#';
else if (ch2[i][j]=='O') cout<<' '<<'O';
else if (ch2[i][j]=='*') cout<<' '<<'*';
else if (ch2[i][j]=='-') cout<<' '<<'-';
else if (ch2[i][j]=='+') cout<<' '<<'+';
else if (ch2[i][j]=='&') cout<<' '<<'#';
else cout<<' '<<' ';
}
cout<<i<<endl;
}
for (int i=1;i<=30;++i) if (i<=9) cout<<' '<<i;else cout<<i;
cout<<endl;
for (int i=1;i<=12;++i)
if (xg[i].fx==0&&ch2[xg[i].xgx][xg[i].xgy+1]!='#') xg[i].xgy++;
else if (xg[i].fx==1&&ch2[xg[i].xgx][xg[i].xgy-1]!='#') xg[i].xgy--;
else if (xg[i].fx==1) xg[i].fx=0;
else xg[i].fx=1;
for (int i=1;i<=12;++i)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"Game Over!";system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0)
{system("cls");cout<<"护盾保护了你!";Sleep(3000);system("cls");
cout<<endl;hd--;xg[i].sw=1;}
char c;
c=getch();
if (c=='w'&&x!=1&&ch2[x-1][y]!='#')x-=1;
else if (c=='s'&&x!=20&&ch2[x+1][y]!='#')x+=1;
else if (c=='a'&&y!=1&&ch2[x][y-1]!='#')y-=1;
else if (c=='d'&&y!=30&&ch2[x][y+1]!='#')y+=1;
system("cls");
if (x==10&&y==10) {cout<<"You Win!";Sleep(5000);mg=1;return 0;}
if (ch2[x][y]=='*') {cout<<"找到了钥匙!";ys++;Sleep(3000);system("cls");if(x==15&&y==28) ch2[15][28]=' ';else ch2[2][2]=' ';}
if (ch2[x][y]=='-'&&ys>0) {cout<<"门开了!";ys--;Sleep(3000);system("cls");if (x==3&&y==30) ch2[3][30]=' ';else ch2[5][28]=' ';}
else if (ch2[x][y]=='-') {cout<<"没有钥匙!";--x;Sleep(3000);system("cls");}
if (ch2[x][y]=='+') {cout<<"找到了护盾!";hd++;Sleep(3000);system("cls");if (x==6&&y==26)ch2[6][26]=' ';}
for (int i=1;i<=12;++i)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"Game Over!";system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(3000);system("cls");hd--;xg[i].sw=1;}
}
}
int yx()
{
int x=1,y=1;
system("cls");
for (int i=1;i<=10;++i)
xg[i].fx=0;
xg[1].xgx=4,xg[1].xgy=17;
xg[2].xgx=6,xg[2].xgy=20;
xg[3].xgx=7,xg[3].xgy=12;
xg[4].xgx=10,xg[4].xgy=26;
xg[5].xgx=15,xg[5].xgy=21;
xg[6].xgx=15,xg[6].xgy=28;
xg[7].xgx=17,xg[7].xgy=10;
xg[8].xgx=17,xg[8].xgy=20;
xg[9].xgx=18,xg[9].xgy=10;
xg[10].xgx=18,xg[10].xgy=20;
while (1)
{
for (int i=1;i<=20;++i)
{
for (int j=1;j<=30;++j)
{
bool f=1;
for (int l=1;l<=10;++l)
if (xg[l].xgx==i&&xg[l].xgy==j&&xg[l].sw==0) {cout<<' '<<'!';f=0;break;}
if (f==1)
if (i==x&&j==y) cout<<' '<<'@';
else if (ch[i][j]=='#') cout<<' '<<'#';
else if (ch[i][j]=='O') cout<<' '<<'O';
else if (ch[i][j]=='*') cout<<' '<<'*';
else if (ch[i][j]=='-') cout<<' '<<'-';
else if (ch[i][j]=='+') cout<<' '<<'+';
else if (ch[i][j]=='&') cout<<' '<<'#';
else cout<<' '<<' ';
}
cout<<i<<endl;
}
for (int i=1;i<=30;++i) if (i<=9) cout<<' '<<i;else cout<<i;
cout<<endl;
for (int i=1;i<=10;++i)
if (xg[i].fx==0&&ch[xg[i].xgx][xg[i].xgy+1]!='#') xg[i].xgy++;
else if (xg[i].fx==1&&ch[xg[i].xgx][xg[i].xgy-1]!='#') xg[i].xgy--;
else if (xg[i].fx==1) xg[i].fx=0;
else xg[i].fx=1;
for (int i=1;i<=10;++i)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"Game Over!";system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0)
{system("cls");cout<<"护盾保护了你!";Sleep(3000);system("cls");
cout<<endl;hd--;xg[i].sw=1;}
char c;
c=getch();
if (c=='w'&&x!=1&&ch[x-1][y]!='#')x-=1;
else if (c=='s'&&x!=20&&ch[x+1][y]!='#')x+=1;
else if (c=='a'&&y!=1&&ch[x][y-1]!='#')y-=1;
else if (c=='d'&&y!=30&&ch[x][y+1]!='#')y+=1;
system("cls");
if (x==20&&y==1) {cout<<"You Win!";Sleep(5000);sl=1;return 0;}
if (ch[x][y]=='*') {cout<<"找到了钥匙!";ys++;Sleep(3000);system("cls");if(x==9&&y==6) ch[9][6]=' ';else ch[7][4]=' ';}
if (ch[x][y]=='-'&&ys>0) {cout<<"门开了!";ys--;Sleep(3000);system("cls");if (x==7&&y==28) ch[7][28]=' ';else ch[11][15]=' ';}
else if (ch[x][y]=='-') {cout<<"没有钥匙!";--x;Sleep(3000);system("cls");}
if (ch[x][y]=='+') {cout<<"找到了护盾!";hd++;Sleep(3000);system("cls");if (x==5&&y==15)ch[5][15]=' ';else ch[13][2]=' ';}
for (int i=1;i<=10;++i)
if (xg[i].xgx==x&&xg[i].xgy==y&&xg[i].sw==0&&hd==0) {system("cls");cout<<"Game Over!";system("cls");return 0;}
else if (xg[i].xgx==x&&xg[i].xgy==y&&hd>0&&xg[i].sw==0) {system("cls");cout<<"护盾保护了你!";Sleep(3000);system("cls");hd--;xg[i].sw=1;}
}
}
void dd()
{
system("cls");
cout<<"9%......";
Sleep(500);
system("cls");
cout<<"26%......";
Sleep(500);
system("cls");
cout<<"33%......";
Sleep(500);
system("cls");
cout<<"47%......";
Sleep(500);
system("cls");
cout<<"68%......";
Sleep(500);
system("cls");
cout<<"82%......";
Sleep(500);
system("cls");
cout<<"94%......";
Sleep(500);
system("cls");
cout<<"100%......";
Sleep(100);
system("cls");
}
void ml(){
while(1)
{
system("cls");
cout<<"1、迷雾森林 ";
cout<<endl;
if (sl==0) cout<<"2、 ? ? ? ? ";
else cout<<"2、巨石迷宫(图中如果可以走玩所有的可穿透墙,就能避开所有的怪) ";
cout<<endl;
if (mg==0) cout<<"3、 ? ? ? ? ";
else cout<<"3、熔岩喷泉(BOSS) ";
cout<<endl;
if (hp==0) cout<<"4、 ? ? ? ? ";
else cout<<"4、火山口(上) ";
cout<<endl;
if (hss==0) cout<<"5、 ? ? ? ? ";
else cout<<"5、火山口(下)(图中随机出现熔岩) ";
cout<<endl;
if (hsx==0) cout<<"6、 ? ? ? ? ";
else cout<<"6、火山祭坛(BOSS)(!代表陨石掉落的地方) ";
cout<<endl;
cout<<"选择关卡(序号)"<<endl;
cout<<"退出输入0"<<endl;
int a;
cin>>a;
if (a==1) {dd();yx();}
if (a==2&&sl==1){dd();yx2();}
if (a==3&&mg==1) {dd();yx3();}
if (a==4&&hp==1) {dd();yx4();}
if (a==5&&hss==1){dd();yx5();}
if (a==6&&hsx==1){dd();yx6();}
if (a==0) return;
}
}
void gz() {
system("cls");
cout<<"由A、W、S、D(小写)控制"<<endl;
cout<<"@是你"<<endl;
cout<<"#是墙"<<endl;
cout<<"O是终点"<<endl;
cout<<"!是小怪(只会左右移动)"<<endl;
cout<<"-是门"<<endl;
cout<<"*是钥匙"<<endl;
cout<<"+是护盾(可把怪反杀)"<<endl;
cout<<" 是隐身小怪"<<endl;
cout<<"#是可穿透墙"<<endl;
cout<<".是水晶(BOSS关破坏所有水晶通关)"<<endl;
cout<<"o是熔岩(无视盾牌)"<<endl;
cout<<"_是尖刺(未升起)"<<endl;
cout<<"^是尖刺(升起)"<<endl;
cout<<"输入1开始"<<endl;
int a;
cin>>a;
if (a==1) ml();
else gz();
}
int main(){
system("color 1E");
cout<<"欢迎来到走迷宫小游戏"<<endl;
cout<<"作者:LZY"<<endl;
cout<<"1、开始"<<endl;
cout<<"2、规则"<<endl;
int a;
cin>>a;
if (a==1)
{
system("cls");
ml();
}
else if (a==2)
{
gz();
}
return 0;
}