怎么改啊,不知道错误,请大神们找错误谢谢!
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <conio.h>
#include <windows.h>
/*
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),); 输出
SetConsoleTextAttribute(GetStdHandle(STD_INPUT_HANDLE),); 输入
FOREGROUND_BLUE 文字颜色包含蓝色
FOREGROUND_GREEN 文字颜色包含绿色
FOREGROUND_RED 文字颜色包含红色
FOREGROUND_INTENSITY 文字颜色加强
BACKGROUND_BLUE 背景颜色包含蓝色
BACKGROUND_GREEN 背景颜色包含绿色
BACKGROUND_RED 背景颜色包含红色
BACKGROUND_INTENSITY 背景颜色加剧
COMMON_LVB_LEADING_BYTE 前导字节
COMMON_LVB_TRAILING_BYTE 尾随字节
COMMON_LVB_GRID_HORIZONTAL 顶部水平
COMMON_LVB_GRID_LVERTICAL 左垂直
COMMON_LVB_GRID_RVERTICAL 正确的垂直
COMMON_LVB_REVERSE_VIDEO 反转前景和背景属性
COMMON_LVB_UNDERSCORE 下划线
*/
using std::cout;
int h1=0,rz;
const int guan = 2;
int wuqi = 0;
bool tongguan1=0;
const int row = 26;
const int col = 18;
bool flag=true;
bool flag2=true;
int x = 1;
int y = 11;
int u=0;
int u1=0;
int x2=1;
int y2=1;
void caidan_caihongmao() {
system("mode con cols=100 lines=100");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"你走进了山洞"<<"\n";
system("pause");
system("cls");
cout<<"里面竟然有..."<<"\n";
system("pause");
system("cls");
/*第0行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"解锁成就:山洞里有...彩虹猫?"<<"\n";
/*第1行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<" # # # # # # # # # # # # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
cout<<"~~~~~ ~~~~~ ~~~~~ "<<"\n";
/*第2行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<" # #";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
/*第3行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<" # #";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
cout<<"~~~~~"<<"\n";
/*第4行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<" # #";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
/*第5行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" ## ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"# ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"## ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
cout<<"~~~~~"<<"\n";
/*第6行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"# ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"# # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"# #";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~~~~~~~~~~~~~~~~"<<"\n";
/*第7行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # # # # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # # #";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
cout<<"~~~~~"<<"\n";
/*第8行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"# ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"~~~~~~~~~~~~~~~~~~~~"<<"\n";
/*第9行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"# # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"# ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # # #";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"~~~~~"<<"\n";
/*第10行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
/*第11行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
cout<<"|__|__| ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<"# ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"#";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"~~~~~";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE);
cout<<"~~~~~"<<"\n";
/*第12行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # # # # # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"# # # # # # # # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<"\n";
/*第13行*/
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
cout<<" # # # # # # # # ";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"~~~~~ ~~~~~ ~~~~~"<<"\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE|FOREGROUND_GREEN);
system("pause");
system("cls");
system("mode con cols=60 lines=30");
}
int liangliang() {
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
for(int i=1; i<=26; i++)
printf(" ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
cout<<"你死了!"<<"\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
for(int i=1; i<=26; i++)
printf(" ");
system("pause");
return 0;
}
int tongguan() {
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
for(int i=1; i<=26; i++)
printf(" ");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
cout<<"通关!"<<"\n";
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
for(int i=1; i<=26; i++)
printf(" ");
system("pause");
h1=1;
return 0;
}
int map[guan][row][col] = {{
{7,7,7,7,7,7,7,7,6,6,6,7,7,0,0,0,0,0},
{7,8,0,0,0,0,3,0,0,0,0,5,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,0},
{7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0},
{7,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,9,9,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,9,9,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0},
},
{
{7,7,7,7,7,7,7,7,6,6,6,7,7,0,0,0,0,0},
{7,8,0,0,0,0,3,0,0,0,0,5,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,0,0},
{7,0,0,0,0,0,3,0,11,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0},
{7,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,11,2,0,0,0,0,0},
{7,0,0,11,0,0,0,11,3,0,0,0,2,0,0,1,0,0},
{7,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,11,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,11,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,11,0,0,0,0,2,0,0,0,0,0},
{7,11,11,0,0,0,0,0,0,0,3,0,2,0,0,0,0,0},
{7,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,3,0,11,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,10,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0},
{7,0,11,0,0,11,0,0,0,11,0,0,2,0,0,0,0,0},
{7,0,0,0,0,0,0,0,0,0,3,3,2,0,0,0,0,0},
{7,3,0,0,3,0,3,0,0,0,3,12,2,0,0,0,0,0},
{7,0,0,11,0,0,0,0,0,3,3,3,2,0,0,0,0,0},
{7,0,0,11,0,0,0,11,0,0,0,0,2,0,0,0,0,0},
{7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0},
}
};
void draw(int sis) {
int i;
for (i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
switch (map[sis][i][j]) {
case 0: {
printf(" ");
break;
}
case 1: {
printf("鸟");
break;
}
case 2: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE|FOREGROUND_GREEN);
printf("河");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
case 3: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_GREEN);
printf("树");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
case 5: {
if(flag)
printf("我");
if(!flag)
printf("鹅");
break;
}
case 6: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
printf("洞");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
case 7: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN);
printf("山");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
case 9: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
printf("家");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
case 8: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_BLUE);
printf("忍");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
case 11: {
printf(". ");
break;
}
case 12: {
printf("剑");
break;
}
case 10: {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED);
printf("玉");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY);
break;
}
}
}
printf("\n");
}
}
void rzmove(int yyy) {
map[yyy][x2][y2] = u1;
if (x2>x&&map[yyy][x2-1][y2]!=3&&map[yyy][x2-1][y2]!=7&&map[yyy][x2-1][y2]!=1&&map[yyy][x2-1][y2]!=2&&map[yyy][x2][y2-1]!=12&&map[yyy][x2][y2-1]!=11) {
x2-=1;
}
if (x2<x&&map[yyy][x2+1][y2]!=3&&map[yyy][x2+1][y2]!=7&&map[yyy][x2+1][y2]!=1&&map[yyy][x2+1][y2]!=2&&map[yyy][x2][y2-1]!=12&&map[yyy][x2][y2-1]!=11) {
x2+=1;
}
if (y2<y&&map[yyy][x2][y2+1]!=3&&map[yyy][x2][y2+1]!=7&&map[yyy][x2][y2+1]!=1&&map[yyy][x2][y2+1]!=2&&map[yyy][x2][y2-1]!=12&&map[yyy][x2][y2-1]!=11) {
y2+=1;
}
if (y2>y&&map[yyy][x2][y2-1]!=3&&map[yyy][x2][y2-1]!=7&&map[yyy][x2][y2-1]!=1&&map[yyy][x2][y2-1]!=2&&map[yyy][x2][y2-1]!=12&&map[yyy][x2][y2-1]!=11) {
y2-=1;
}
u1=map[yyy][x2][y2];
map[yyy][x2][y2] = 8;
// draw();
}
void move(int _x, int _y,int xxx) {
if (map[xxx][x + _x][y + _y] == 2 || map[xxx][x + _x][y + _y] == 5) {
if(flag)
return;
}
if (map[xxx][x + _x][y + _y] == 9||map[xxx][x + _x][y + _y] == 10 ) {
tongguan();
return ;
}
if (map[xxx][x + _x][y + _y] == 7 || map[xxx][x + _x][y + _y] == 5) {
return;
}
if (map[xxx][x + _x][y + _y] == 12) {
wuqi=1;
return;
}
if(map[xxx][x+_x][y+_y]==3)
return;
if(map[xxx][x+_x][y+_y]==8||map[xxx][x+_x][y+_y]==11)
liangliang();
if (map[xxx][x + _x][y + _y] == 1) {
if (map[xxx][x + 2 * _x][y + 2 * _y] == 2) {
return;
}
map[xxx][x + _x][y + _y] = 0;
flag=false;
move(_x, _y,xxx);
return;
}
if(map[xxx][x+_x][y+_y]==6)
caidan_caihongmao();
map[xxx][x][y] = u;
u=map[xxx][x+_x][y+_y];
x += _x;
y += _y;
map[xxx][x][y] = 5;
// draw();
}
void step(char o,int d) {
switch (o) {
case 'w': {
move(-1,0,d);
break;
}
case 's': {
move(1, 0,d);
break;
}
case 'd': {
move(0, 1,d);
break;
}
case 'a': {
move(0, -1,d);
break;
}
}
}
int main() {
system("mode con cols=60 lines=30");
rz=1;
for(int i=1; i<=12; i++)
printf("\n");
printf(" 欢迎来到汉字的世界\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("旁白:你从汉字大师那里苦学六年本领,今天是你毕业的日子\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("旁白:来到这条熟悉的河前面,你已经可以看到你的家乡——汉字村了\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("旁白:突然,从远处杀出个忍者\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("旁白:赶快过河回村\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("提示:改变自己,会让你走得更远\n");
system("pause");
system("cls");
while (true) {
draw(1);
step(_getch(),1);
rzmove(1);
system("cls");
if(h1)
break;
}
rz=2;
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("旁白:大家都看到了你,很欢喜,他们说你可以帮他们拿到一个宝玉,被偷走了\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("旁白:你说行,大家都说谢谢,就这么定下来了\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("天使:前面有一个二级快忍者,你搞得定么?\n");
system("pause");
system("cls");
for(int i=1; i<=12; i++)
printf("\n");
printf("天使:我听说路上有武器,可以战斗,但有很多陷阱(.)记得防范\n");
system("pause");
system("cls");
while (true) {
draw(2);
step(_getch(),2);
if(wuqi==0)
{
rzmove(2);
rzmove(2);
}
if(wuqi=1)
{
cout<<"你有武器了!你朝向忍者一扔--------当----忍者晕了。";
system("pause");
system("cls");
}
system("cls");
if(h1){
for(int i=1; i<=12; i++)printf("\n");
printf("艾欧:未完待续,记得关注,记得点赞哦!!\n");
system("pause");
system("cls");
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n 完");
return 0;
}
}
}
这个第一幅图竟然和二幅图合并了!第二幅输出时是乱码!谢谢纠错!!!