转载请标明出处
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include <iostream>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
POINT p;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
using namespace std;
void S(int x,int y)
{
COORD pos;
pos.X=y,pos.Y=x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void H() {
CONSOLE_CURSOR_INFO cciCursor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
cciCursor.bVisible = FALSE;
SetConsoleCursorInfo(hStdOut, &cciCursor);
}
}
void C(int wr,int wg,int wb,int br,int bg,int bb) {
printf("\033[38;2;%d;%d;%dm\033[48;2;%d;%d;%dm",wr,wg,wb,br,bg,bb);
}
struct ss{
int x,y;
};
int gs=10;
ss f[100]={{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2},{27,2}};
ss portal1[100]={{0,0},{0,0},{0,0},{0,0},{13,28},{1,93},{6,15},{6,80},{0,0}};
ss portal2[100]={{0,0},{0,0},{0,0},{0,0},{0,0},{28,41},{0,0},{27,90},{0,0}};
char ma[100][33][104]={
{
{"####################################################################################################"},
{"# #"},
{"# #"},
{"# #"},
{"# [] #"},
{"# ######################### #"},
{"# #"},
{"# #"},
{"# ################ #"},
{"# #"},
{"# 第一关: ☆ #"},
{"# ############# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! #"},
{"# ##################### #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# ############ #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# 第二关:☆☆ | #"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | []#"},
{"# ######################## ########### #######"},
{"# ########### # #"},
{"# # #"},
{"# # o !!!!!!#"},
{"# ######################################################"},
{"# #"},
{"# ################# #"},
{"# #"},
{"# #"},
{"# ################ #"},
{"# #"},
{"# #"},
{"# ################## #"},
{"# #"},
{"# #"},
{"# ################### #"},
{"# #"},
{"# #"},
{"# #"},
{"################################### #"}
},
{
{"####################################################################################################"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | ######################### #"},
{"# [] | #"},
{"############### #"},
{"# ################ ######################## #"},
{"# #"},
{"# #"},
{"# ############ #"},
{"# #"},
{"# ####################### #"},
{"# o #"},
{"# ############### ###### ######"},
{"# #"},
{"# !! #"},
{"# ##################### #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# 第三关:☆☆☆☆ #"},
{"# ############ #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# 第四关:☆☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# ####### #"},
{"# # #"},
{"# # #"},
{"# # #"},
{"# ######## ######################################################## #"},
{"# # # #"},
{"# # ################################################# # #"},
{"# # # | # # #"},
{"# # # [] | # # #"},
{"# # ############################################## # # #"},
{"# ## # # # # #"},
{"# # # ############################################## # #"},
{"# # # o !! #"},
{"### ######## ######################################################## ############################"}
},
{
{"####################################################################################################"},
{"# | #"},
{"# | #"},
{"# | ! #"},
{"# | ##[] ! #"},
{"# |{} ### ! #"},
{"############## ##############!!!!!!!!! 第五关:o ☆☆☆☆ #"},
{"# # !! #"},
{"# # #"},
{"# ####################!!# #"},
{"# # #"},
{"# ############################## #"},
{"# # ########################## #"},
{"# # # #"},
{"################################ # #"},
{"# # #"},
{"# # #"},
{"# # #"},
{"# ####### ####### ###### # #"},
{"# # !!!!!!!!!!!!!#"},
{"# !!!!!!!!!!!!!!!!?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # #"},
{"# # #"},
{"# # #"},
{"# ##################### # #"},
{"# # #"},
{"# # #"},
{"# ############## #"},
{"# # #"},
{"# # --- #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# * # | # #"},
{"# ####### # ######### # #"},
{"# ####### # # # # #"},
{"# # ! # # # # #"},
{"# # !!!! # ## # # # #"},
{"# #!!! !!!!!# # #第六关:☆☆☆☆☆ # !!! ! # #"},
{"# ## # # * # # # #"},
{"# # # # # # # # #"},
{"# # ! # #!!!!!!!! # # # #"},
{"# # # # # # # #"},
{"# # # # # ## # #"},
{"# # ! # # !# # # #"},
{"# # !! # # # # # #"},
{"## # # ##!!!!!!! # # []!!!!!!!! # #"},
{"# # !!! # # # # # #"},
{"# # # # !! # # # #"},
{"# # # # # # ## # #"},
{"# # # #!!!!!!!! # # # !! # #"},
{"# # !!!!!!!! # * # # # # #"},
{"# ## # #!!!! # !!!! # #"},
{"# # # # # [] # #"},
{"# # #### # ## ## # #"},
{"# # # # # # # #"},
{"# #!!!!!! !!!!!!# ! # # # # #"},
{"# # # # !!!!! # # # #"},
{"# # ###### ##### # # # #"},
{"# # # # # # o #"},
{"# #!!!!! * #!!!!!!!!! * # # #!!!!!!!!+ !!!!#"},
{"########################################## - ####### ######### ######### #####"},
},
{
{"####################################################################################################"},
{"# #"},
{"# 第七关:☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # # [] #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# ################# ############### # ################ #"},
{"#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# -#"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"# 第八关:☆☆☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# # # # # # #"},
{"# # # # ## # #"},
{"# # # # # # # #"},
{"# # # # # # # # #"},
{"# # # # # # # # #"},
{"# # # # # # # # #"},
{"# # o # # # #"},
{"# # # # # # # #"},
{"# # # # # # # #"},
{"# # # # # # #"},
{"# # # # # # #"},
{"# + # # # # # #"},
{"# # # # # # # #"},
{"# # # # # ## #"},
{"# #### # # # #"},
{"#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#"},
{"# | | # | #"},
{"# | | # | #"},
{"# | -| # | #"},
{"# ### # # | #"},
{"# # | #"},
{"# # | [] #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"# #"},
{"# #"},
{"# [] #"},
{"# ######################### #"},
{"# #"},
{"# #"},
{"# ############### #"},
{"# # #"},
{"# # 第九关: ☆☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# <<<<<<<<>>>>>>>>>>>!! #"},
{"# ##################### #"},
{"# # #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# >>>>>>>>>>>> #"},
{"# ############## #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"##############################################################################################- #"},
{"# - # # # #"},
{"# # # - #"},
{"# ##################### - ### - # # #"},
{"# ################# - # -#"},
{"#--# 第十关: # # # #"},
{"# # - ☆☆☆☆☆ # -- - # #"},
{"# # # --# # #"},
{"# # - # # ################ #########################"},
{"# # # #"},
{"# ########### # # - #"},
{"# -- ------- # - #"},
{"# # # #"},
{"# - # #- #"},
{"#- # # - #"},
{"# # #"},
{"# - # #"},
{"# ##################################### ################"},
{"# o | - #"},
{"######### - - - #"},
{"# - - - - - #"},
{"#|||||||| - #"},
{"# - # - - - - - - - #"},
{"#- ## ## - - - - #"},
{"#[]- - - # # - - - #"},
{"########## # - #"},
{"#! # - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - +#"},
{"####################################################################################################"},
},
};
int bou=0;
bool bou2;
char con;
bool tg=1;
int cdx=27,cdy=2;
int bbb;
int main(){
H();
HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwInMode, dwOutMode;
GetConsoleMode(hIn, &dwInMode);
GetConsoleMode(hOut, &dwOutMode);
dwInMode |= 0x0200;
dwOutMode |= 0x0004;
SetConsoleMode(hIn, dwInMode);
SetConsoleMode(hOut, dwOutMode);
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin, mode);
while(1){
for(int g=0;g<gs;g++){
if(tg==1){
char ph;
ph=getch();
system("cls");
if(ph=='A')continue;
}
bool an;
for(int i=0;i<30;i++){
for(int j=0;j<104;j++){
if(ma[g][i][j]=='!'){
C(255,0,0,255,0,0);
cout<<' ';
C(255,255,255,0,0,0);
continue;
}
cout<<ma[g][i][j];
}
if(i!=103)cout<<endl;
}
bou=0;
bou2=0;
int x,y;
x=f[g].x;
y=f[g].y;
while(ma[g][x][y]!='['&&ma[g][x][y]!=']'){
bbb++;
bbb%=4;
if(x>30){
g-=1;
break;
}
if(ma[g][x][y]=='o'){
an=1;
}
if(ma[g][x][y]=='-'){
S(x,y);
cout<<' ';
x=portal1[g].x;y=portal1[g].y;
}
if(ma[g][x][y]=='+'){
S(x,y);
cout<<' ';
x=portal2[g].x;y=portal2[g].y;
}
if(ma[g][x][y]=='*'){
cdx=x;
cdy=y;
}
if(_kbhit()){
con=getch();
}
else con=' ';
S(x,y);
cout<<ma[g][x][y];
if(ma[g][x][y]=='>'&&bbb!=0)y++;
if(ma[g][x][y]=='<'&&bbb!=0)y--;
if(ma[g][x][y]=='!'){
system("cls");
x=cdx;
y=cdy;
for(int i=0;i<30;i++){
for(int j=0;j<104;j++){
if(ma[g][i][j]=='!'){
C(255,0,0,255,0,0);
cout<<' ';
C(255,255,255,0,0,0);
continue;
}
if(ma[g][i][j]=='o'&&an==1){
cout<<' ';
}
else cout<<ma[g][i][j];
}
if(i!=103)cout<<endl;
}
}
if(con=='w'&&bou==0&&bou2==0){
bou2=1;
}
if(bou2&&bou<9){
if(ma[g][x-1][y]=='#'||ma[g][x-1][y]=='|'&&an==0){
bou=0;
bou2=0;
}
else{
bou++;
x--;
}
}
else {
bou2=0;
bou=0;
}
if(bou2==0&&ma[g][x+1][y]!='#'&&(ma[g][x+1][y]!='|'||(an==1))){
if(g!=5)bou=1;
x++;
}
if(con=='a'&&ma[g][x][y-1]!='#'&&ma[g][x][y-1]!='|'){
y--;
}
if(con=='a'&&ma[g][x][y-1]=='|'&&an==1){
y--;
}
if(con=='d'&&ma[g][x][y+1]!='#'&&ma[g][x][y+1]!='|'){
y++;
}
if(con=='d'&&ma[g][x][y+1]=='|'&&an==1){
y++;
}
S(x,y);
cout<<'A';
Sleep(50);
S(31,0);
}
an=0;
system("cls");
}
tg=1;
system("cls");
}
return 0;
}
以上代码对某些电脑不太友好,所以有了第二版:
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include <iostream>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
POINT p;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
using namespace std;
void S(int x,int y)
{
COORD pos;
pos.X=y,pos.Y=x-1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void H() {
CONSOLE_CURSOR_INFO cciCursor;
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
cciCursor.bVisible = FALSE;
SetConsoleCursorInfo(hStdOut, &cciCursor);
}
}
void C(int wr,int wg,int wb,int br,int bg,int bb) {
}
struct ss{
int x,y;
};
int gs=10;
ss f[100]={{26,2},{26,2},{26,2},{26,2},{26,2},{26,2},{26,2},{26,2},{26,2},{28,2}};
ss portal1[100]={{0,0},{0,0},{0,0},{0,0},{13,28},{1,93},{6,15},{6,80},{0,0},{28,2}};
ss portal2[100]={{0,0},{0,0},{0,0},{0,0},{0,0},{28,41},{0,0},{27,90},{0,0},{1,1}};
char ma[100][33][104]={
{
{"####################################################################################################"},
{"# #"},
{"# #"},
{"# #"},
{"# [] #"},
{"# ######################### #"},
{"# #"},
{"# #"},
{"# ################ #"},
{"# #"},
{"# 第一关: ☆ #"},
{"# ############# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! #"},
{"# ##################### #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# ############ #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# 第二关:☆☆ | #"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | []#"},
{"# ######################## ########### #######"},
{"# ########### # #"},
{"# # #"},
{"# # o !!!!!!#"},
{"# ######################################################"},
{"# #"},
{"# ################# #"},
{"# #"},
{"# #"},
{"# ################ #"},
{"# #"},
{"# #"},
{"# ################## #"},
{"# #"},
{"# #"},
{"# ################### #"},
{"# #"},
{"# #"},
{"# #"},
{"################################### #"}
},
{
{"####################################################################################################"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | #"},
{"# | ######################### #"},
{"# [] | #"},
{"############### #"},
{"# ################ ######################## #"},
{"# #"},
{"# #"},
{"# ############ #"},
{"# #"},
{"# ####################### #"},
{"# o #"},
{"# ############### ###### ######"},
{"# #"},
{"# !! #"},
{"# ##################### #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# 第三关:☆☆☆☆ #"},
{"# ############ #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# 第四关:☆☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# ####### #"},
{"# # #"},
{"# # #"},
{"# # #"},
{"# ######## ######################################################## #"},
{"# # # #"},
{"# # ################################################# # #"},
{"# # # | # # #"},
{"# # # [] | # # #"},
{"# # ############################################## # # #"},
{"# ## # # # # #"},
{"# # # ############################################## # #"},
{"# # # o !! #"},
{"### ######## ######################################################## ############################"}
},
{
{"####################################################################################################"},
{"# | #"},
{"# | #"},
{"# | ! #"},
{"# | ##[] ! #"},
{"# |{} ### ! #"},
{"############## ##############!!!!!!!!! 第五关:o ☆☆☆☆ #"},
{"# # !! #"},
{"# # #"},
{"# ####################!!# #"},
{"# # #"},
{"# ############################## #"},
{"# # ########################## #"},
{"# # # #"},
{"################################ # #"},
{"# # #"},
{"# # #"},
{"# # #"},
{"# ####### ####### ###### # #"},
{"# # !!!!!!!!!!!!!#"},
{"# !!!!!!!!!!!!!!!!?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # #"},
{"# # #"},
{"# # #"},
{"# ##################### # #"},
{"# # #"},
{"# # #"},
{"# ############## #"},
{"# # #"},
{"# # --- #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# * # | # #"},
{"# ####### # ######### # #"},
{"# ####### # # # # #"},
{"# # ! # # # # #"},
{"# # !!!! # ## # # # #"},
{"# #!!! !!!!!# # #第六关:☆☆☆☆☆ # !!! ! # #"},
{"# ## # # * # # # #"},
{"# # # # # # # # #"},
{"# # ! # #!!!!!!!! # # # #"},
{"# # # # # # # #"},
{"# # # # # ## # #"},
{"# # ! # # !# # # #"},
{"# # !! # # # # # #"},
{"## # # ##!!!!!!! # # []!!!!!!!! # #"},
{"# # !!! # # # # # #"},
{"# # # # !! # # # #"},
{"# # # # # # ## # #"},
{"# # # #!!!!!!!! # # # !! # #"},
{"# # !!!!!!!! # * # # # # #"},
{"# ## # #!!!! # !!!! # #"},
{"# # # # # [] # #"},
{"# # #### # ## ## # #"},
{"# # # # # # # #"},
{"# #!!!!!! !!!!!!# ! # # # # #"},
{"# # # # !!!!! # # # #"},
{"# # ###### ##### # # # #"},
{"# # # # # # o #"},
{"# #!!!!! * #!!!!!!!!! * # # #!!!!!!!!+ !!!!#"},
{"########################################## - ####### ######### ######### #####"},
},
{
{"####################################################################################################"},
{"# #"},
{"# 第七关:☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # # [] #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# # # # #"},
{"# ################# ############### # ################ #"},
{"#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# -#"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"# 第八关:☆☆☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# # # # # # #"},
{"# # # # ## # #"},
{"# # # # # # # #"},
{"# # # # # # # # #"},
{"# # # # # # # # #"},
{"# # # # # # # # #"},
{"# # o # # # #"},
{"# # # # # # # #"},
{"# # # # # # # #"},
{"# # # # # # #"},
{"# # # # # # #"},
{"# + # # # # # #"},
{"# # # # # # # #"},
{"# # # # # ## #"},
{"# #### # # # #"},
{"#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#"},
{"# | | # | #"},
{"# | | # | #"},
{"# | -| # | #"},
{"# ### # # | #"},
{"# # | #"},
{"# # | [] #"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"# #"},
{"# #"},
{"# [] #"},
{"# ######################### #"},
{"# #"},
{"# #"},
{"# ############### #"},
{"# # #"},
{"# # 第九关: ☆☆☆ #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# <<<<<<<<>>>>>>>>>>>!! #"},
{"# ##################### #"},
{"# # #"},
{"# #"},
{"# #"},
{"# #"},
{"# #"},
{"# >>>>>>>>>>>> #"},
{"# ############## #"},
{"# #"},
{"# #"},
{"# #"},
{"# !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#"},
{"####################################################################################################"}
},
{
{"####################################################################################################"},
{"# #"},
{"##############################################################################################- #"},
{"# - # # # #"},
{"# # # - #"},
{"# ##################### - ### - # # #"},
{"# ################# - # -#"},
{"#--# 第十关: # # # #"},
{"# # - ☆☆☆☆☆ # -- - # #"},
{"# # # --# # #"},
{"# # - # # ################ #########################"},
{"# # # #"},
{"# ########### # # - #"},
{"# -- ------- # - #"},
{"# # # #"},
{"# - # #- #"},
{"#- # # - #"},
{"# # #"},
{"# - # #"},
{"# ##################################### ################"},
{"# o | - #"},
{"######### - - - #"},
{"# - - - - - #"},
{"#|||||||| - #"},
{"# - # - - - - - - - #"},
{"#- ## ## - - - - #"},
{"#[]- - - # # - - - #"},
{"########## # - #"},
{"#! # - - - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - +#"},
{"####################################################################################################"},
},
};
int bou=0;
bool bou2;
char con;
bool tg=1;
int cdx=27,cdy=2;
int main(){
H();
HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwInMode, dwOutMode;
GetConsoleMode(hIn, &dwInMode);
GetConsoleMode(hOut, &dwOutMode);
dwInMode |= 0x0200;
dwOutMode |= 0x0004;
SetConsoleMode(hIn, dwInMode);
SetConsoleMode(hOut, dwOutMode);
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(hStdin, mode);
int bbb=0;
while(1){
for(int g=0;g<gs;g++){
if(tg==1){
cout<<"是否跳过第"<<g+1<<"关? A.是 B.否";
char ph;
ph=getch();
system("cls");
if(ph=='A')continue;
}
bool an;
for(int i=0;i<30;i++){
for(int j=0;j<104;j++){
cout<<ma[g][i][j];
}
if(i!=103)cout<<endl;
}
bou=0;
bou2=0;
int x,y;
x=f[g].x;
y=f[g].y;
while(ma[g][x][y]!='['&&ma[g][x][y]!=']'){
bbb++;
if(bbb==4)bbb=0;
if(x>30){
g-=1;
break;
}
if(ma[g][x][y]=='o'){
an=1;
}
if(ma[g][x][y]=='-'){
S(x,y);
cout<<' ';
x=portal1[g].x;y=portal1[g].y;
}
if(ma[g][x][y]=='+'){
S(x,y);
cout<<' ';
x=portal2[g].x;y=portal2[g].y;
}
if(ma[g][x][y]=='*'){
cdx=x;
cdy=y;
}
if(_kbhit()){
con=getch();
}
else con=' ';
S(x,y);
cout<<ma[g][x][y];
if(ma[g][x][y]=='>'&&bbb!=0)y++;
if(ma[g][x][y]=='<'&&bbb!=0)y--;
if(ma[g][x][y]=='!'){
system("cls");
x=cdx;
y=cdy;
for(int i=0;i<30;i++){
for(int j=0;j<104;j++){
if(ma[g][i][j]=='o'&&an==1){
cout<<' ';
}
else cout<<ma[g][i][j];
}
if(i!=103)cout<<endl;
}
}
if(con=='w'&&bou==0&&bou2==0){
bou2=1;
}
if(bou2&&bou<9){
if(ma[g][x-1][y]=='#'||ma[g][x-1][y]=='|'&&an==0){
bou=0;
bou2=0;
}
else{
bou++;
x--;
}
}
else {
bou2=0;
bou=0;
}
if(bou2==0&&ma[g][x+1][y]!='#'&&(ma[g][x+1][y]!='|'||(an==1))){
if(g!=5)bou=1;
x++;
}
if(con=='a'&&ma[g][x][y-1]!='#'&&ma[g][x][y-1]!='|'){
y--;
}
if(con=='a'&&ma[g][x][y-1]=='|'&&an==1){
y--;
}
if(con=='d'&&ma[g][x][y+1]!='#'&&ma[g][x][y+1]!='|'){
y++;
}
if(con=='d'&&ma[g][x][y+1]=='|'&&an==1){
y++;
}
S(x,y);
cout<<'A';
Sleep(50);
S(31,0);
}
an=0;
system("cls");
}
tg=1;
system("cls");
}
return 0;
}食用须知:
- wasd操控
- ’#‘是墙壁
- ‘o’是按钮,按钮如果没有被按下,人物就无法穿过’|’
- 红色的是销毁,碰到直接回家
- 小心踩空
- ’-‘是传送门,传送位置不确定(传送门由jiangyunuo制作)
- 有些关卡可以n段跳
- ’>‘和’<‘是传送带
- 记得三连(点赞+收藏+关注作者)