问题标题: 跪求地图

0
0
已解决
武奕楷
武奕楷
新手天翼
新手天翼
#include<iostream>
#include<windows.h>
using namespace std;
int map[13][9]={
	{1,1,1,1,1,1,1,1,1},
	{1,0,0,0,0,1,1,1,1},
	{1,0,1,1,0,0,0,0,1},
	{1,0,0,0,1,1,1,0,1},
	{1,1,1,5,1,0,1,0,1},
	{1,0,3,1,1,0,0,0,1},
	{1,4,0,0,0,1,1,0,1},
	{1,0,0,4,0,1,4,0,1},
	{1,0,1,0,0,0,1,0,1},
	{1,0,1,1,4,0,0,0,1},
	{1,0,0,1,0,0,1,1,1},
	{1,1,1,0,0,1,0,0,1},
	{1,1,1,1,1,1,1,1,1},
};
int map1[15][15]=
{
	{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
	{1,0,1,3,0,0,0,0,0,0,0,0,0,0,1},
	{1,0,1,0,1,1,1,1,0,1,1,1,0,4,1},
	{1,0,1,0,0,0,0,4,0,1,0,0,4,0,1},
	{1,0,0,4,0,1,1,0,0,4,0,0,0,0,1},
	{1,0,0,1,0,1,0,1,0,0,0,0,0,0,1},
	{1,0,0,0,1,0,4,0,0,0,0,0,0,0,1},
	{1,1,4,0,1,0,0,0,0,1,1,0,0,0,1},
	{1,0,0,1,0,1,0,0,4,0,0,1,4,0,1},
	{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
	{1,0,1,1,1,0,1,0,0,0,0,1,0,0,1},
	{1,0,1,0,0,0,0,0,0,0,0,0,0,0,1},
	{1,0,1,1,1,1,1,1,1,1,1,1,1,0,1},
	{1,0,0,0,0,0,0,0,0,0,5,1,0,1,1},
	{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
};
char a;
int x=5,y=2;
int main(){
	while(1){
		cout<<"第一关\n";
		for(int i=0;i<13;i++){
			for(int j=0;j<9;j++){
				if(map[i][j]==1){
					cout<<"□";
				} else if(map[i][j]==0){
					cout<<"  ";
				} else if(map[i][j]==4){
					cout<<"◤";
				} else if(map[i][j]==3){
					cout<<"♀";
				} else {
					cout<<"〓";
				}
			}
			cout<<endl;
		}
		cout<<"w(上)s(下)a(左)d(右),◤是炸弹,□是墙,〓是门\n";
		cin>>a;
		if(a=='w'||a=='W'){
			if(map[x-1][y]==0||map[x-1][y]==4||map[x-1][y]==5){
				if(map[x-1][y]==4||map[x-1][y]==5){
					x--;
					break;
				} 
				map[x][y]=0;
				x--;
				map[x][y]=3;
			}
		} else if(a=='s'||a=='S'){
			if(map[x+1][y]==0||map[x+1][y]==4||map[x+1][y]==5){
				if(map[x+1][y]==4||map[x+1][y]==5){
					x++;
					break;
				} 
				map[x][y]=0;
				x++;
				map[x][y]=3;
			}
		} else if(a=='a'||a=='A'){
			if(map[x][y-1]==0||map[x][y-1]==4||map[x][y-1]==5){
				if(map[x][y-1]==4||map[x][y-1]==5){
					y--;
					break;
				} 
				map[x][y]=0;
				y--;
				map[x][y]=3;
			}
		} else if(a=='d'||a=='D'){
			if(map[x][y+1]==0||map[x][y+1]==4||map[x][y+1]==5){
				if(map[x][y+1]==4||map[x][y+1]==5){
					y++;
					break;
				} 
				map[x][y]=0;
				y++;
				map[x][y]=3;
			}
		}
		system("cls");
	}
	Sleep(100);
	system("cls");
	if(map[x][y]==4) cout<<"你**了!!!";
	else cout<<"你赢了!!!";
	Sleep(1000);
	x=1,y=3;
	system("cls");
	while(1){
		cout<<"第二关\n";
		for(int i=0;i<15;i++){
			for(int j=0;j<15;j++){
				if(map1[i][j]==1){
					cout<<"□";
				} else if(map1[i][j]==0){
					cout<<"  ";
				} else if(map1[i][j]==4){
					cout<<"◤";
				} else if(map1[i][j]==3){
					cout<<"♀";
				} else {
					cout<<"〓";
				}
			}
			cout<<endl;
		}
		cout<<"w(上)s(下)a(左)d(右),◤是炸弹,□是墙,〓是门\n";
		cin>>a;
		if(a=='w'||a=='W'){
			if(map1[x-1][y]==0||map1[x-1][y]==4||map1[x-1][y]==5){
				if(map1[x-1][y]==4||map1[x-1][y]==5){
					x--;
					break;
				} 
				map1[x][y]=0;
				x--;
				map1[x][y]=3;
			}
		} else if(a=='s'||a=='S'){
			if(map1[x+1][y]==0||map1[x+1][y]==4||map1[x+1][y]==5){
				if(map1[x+1][y]==4||map1[x+1][y]==5){
					x++;
					break;
				} 
				map1[x][y]=0;
				x++;
				map1[x][y]=3;
			}
		} else if(a=='a'||a=='A'){
			if(map1[x][y-1]==0||map1[x][y-1]==4||map1[x][y-1]==5){
				if(map1[x][y-1]==4||map1[x][y-1]==5){
					y--;
					break;
				} 
				map1[x][y]=0;
				y--;
				map1[x][y]=3;
			}
		} else if(a=='d'||a=='D'){
			if(map1[x][y+1]==0||map1[x][y+1]==4||map1[x][y+1]==5){
				if(map1[x][y+1]==4||map1[x][y+1]==5){
					y++;
					break;
				} 
				map1[x][y]=0;
				y++;
				map1[x][y]=3;
			}
		}
		system("cls");
	}
	Sleep(100);
	system("cls");
	if(map1[x][y]==4) cout<<"你**了!!!";
	else cout<<"你赢了!!!";
	return 0;
}

 

谁能给出地图的数组???谁的越多就采纳谁

武奕楷在2021-08-31 11:16:04追加了内容

NO WATER!!!

不许水!!!

武奕楷在2021-08-31 19:47:10追加了内容


0
已采纳
王文博
王文博
缔造者之神
缔造者之神

建议:

1.没有颜色

2.输入后要按Enter键,有点麻烦

具体可以看一下我的推箱子简短版

另外,每走一步就闪一下,可以用一下推箱子里面的clear()函数。

0
肖俊宁
肖俊宁
高级守护
高级守护

同王文博

(为什么**了也会过关?)

0
朱小川
朱小川
缔造者
缔造者

{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},

 

{1,0,1,3,0,0,0,1,0,0,0,0,0,0,1},

 

{1,0,1,0,1,1,1,1,0,1,1,1,0,4,1},

 

{1,0,1,0,0,0,0,4,0,1,0,0,4,0,1},

 

{1,0,0,4,0,1,1,0,0,4,0,0,0,0,1},

 

{1,0,0,1,0,1,0,1,0,0,0,0,0,0,1},

 

{1,0,0,0,1,0,4,0,0,0,0,0,0,0,1},

 

{1,1,4,0,1,0,0,0,0,1,1,0,0,0,1},

 

{1,0,0,1,0,1,0,0,4,0,0,1,4,0,1},

 

{1,0,0,0,0,0,1,0,0,0,0,0,0,0,1},

 

{1,0,1,1,1,0,1,0,0,0,0,1,0,0,1},

 

{1,0,1,0,0,0,0,0,0,0,0,4,0,0,1},

 

{1,0,1,1,1,1,1,1,1,1,1,1,1,0,1},

 

{1,0,0,0,0,0,0,0,0,0,5,1,0,1,1},

 

{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},

0
我要回答