问题标题: 酷町堂:更新了!!!,游戏行走2.1.1出来了。

0
0
已解决
王子逸
王子逸
新手天翼
新手天翼
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
using namespace std;
int main()
{
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
				  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0},
				  {1,1,1,1,1,1,1,1,1,8,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
				  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(a[i][j]==1)
				  		{SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  }
						  else if(a[i][j]==2)
						  {
						  	cout<<"HH";
						  }
						  else if(a[i][j]==3)
						  {
						  	cout<<"N ";
						  }
						  else if(a[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(a[i][j]==9)
						  {
						  	
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<"GD";
						  }
						  else if(a[i][j]==8)
						  { SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"MM"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='a')
				{
					if(a[x+1][y-1]==8)
					{
						system("cls");
						system("color 0F");
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y-1]==0&&a[x+1][y]!=1)
					{
						a[x+1][y-1]=9;
						a[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
					{
						a[x-1][y-1]=9;
						a[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
				 } 
				else if(ch=='d')
				{
					if(a[x+1][y+1]==8)
					{
						system("cls");
						system("color 0F") ;
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
					{
						a[x+1][y+1]=9;
						a[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(a[x][y+1]==1)
					 {
					 	a[x-1][y+1]=9;
					 	a[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	a[x][y+1]=9;
					a[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				
				else
				{
					system("cls");
				}
				}
				return 0;
}

 

王子逸在2020-05-23 15:47:34追加了内容

此次更新了主人物颜色,以及危险的颜色,2.1.2的计划是添加目标和新地图,此外,我还要收集意见(-_-)

王子逸在2020-05-23 15:52:58追加了内容

另外问一下,在坐的各位有没有提高流畅度的方法

王子逸在2020-05-23 16:02:29追加了内容

有个bug

王子逸在2020-05-23 16:05:59追加了内容

顺便透露一下 正在制作的另一个游戏

王子逸在2020-05-23 16:35:18追加了内容

我突然想起来,大家给我建议一下,通关条件

王子逸在2020-05-23 16:44:54追加了内容
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
using namespace std;
int main()
{
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
				  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0},
				  {1,1,1,1,1,1,1,1,1,8,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
				  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(a[i][j]==1)
				  		{SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  }
						  else if(a[i][j]==2)
						  {
						  	cout<<"HH";
						  }
						  else if(a[i][j]==3)
						  {
						  	cout<<"N ";
						  }
						  else if(a[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(a[i][j]==9)
						  {
						  	
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<"GD";
						  }
						  else if(a[i][j]==8)
						  { SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"MM"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='a')
				{
					if(a[x+1][y-1]==8)
					{
						system("cls");
						system("color 0F");
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y-1]==0&&a[x+1][y]!=1)
					{
						a[x+1][y-1]=9;
						a[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
					{
						a[x-1][y-1]=9;
						a[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
				 } 
				else if(ch=='d')
				{
					if(a[x+1][y+1]==8)
					{
						system("cls");
						system("color 0F") ;
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
					{
						a[x+1][y+1]=9;
						a[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(a[x][y+1]==1)
					 {
					 	a[x-1][y+1]=9;
					 	a[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	a[x][y+1]=9;
					a[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&a[x-1][y]!=1&&(a[x][y+1]||a[x][y-1]==1)) 
				{
					a[x-1][y]=9;
					a[x][y]=0;
					x--;
					system("cls");
				}
				else
				{
					system("cls");
				}
				}
				return 0;
}

更新一下,w键可以爬墙了!!!

王子逸在2020-05-23 16:52:34追加了内容
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
using namespace std;
int main()
{
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
				  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0},
				  {1,1,1,1,1,1,1,1,1,8,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
				  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(a[i][j]==1)
				  		{SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  }
						  else if(a[i][j]==2)
						  {
						  	cout<<"HH";
						  }
						  else if(a[i][j]==3)
						  {
						  	cout<<"N ";
						  }
						  else if(a[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(a[i][j]==9)
						  {
						  	
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<"GD";
						  }
						  else if(a[i][j]==8)
						  { SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"MM"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='a')
				{
					if(a[x+1][y-1]==8)
					{
						system("cls");
						system("color 0F");
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y-1]==0&&a[x+1][y]!=1)
					{
						a[x+1][y-1]=9;
						a[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
					{
						a[x-1][y-1]=9;
						a[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
				 } 
				else if(ch=='d')
				{
					if(a[x+1][y+1]==8)
					{
						system("cls");
						system("color 0F") ;
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
					{
						a[x+1][y+1]=9;
						a[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(a[x][y+1]==1)
					 {
					 	a[x-1][y+1]=9;
					 	a[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	a[x][y+1]=9;
					a[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&a[x-1][y]!=1&&(a[x][y+1]||a[x][y-1]==1)) 
				{
					a[x-1][y]=9;
					a[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&a[x+1][y]!=1&&(a[x][y+1]||a[x][y-1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x--;
					system("cls");
				}
				else
				{
					system("cls");
				}
				}
				return 0;
}

s键可以从墙上下来了

王子逸在2020-05-23 16:57:28追加了内容

发错了

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
using namespace std;
int main()
{
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int a[11][36]{{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
				  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0},
				  {1,1,1,1,1,1,1,1,1,8,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
				  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(a[i][j]==1)
				  		{SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  }
						  else if(a[i][j]==2)
						  {
						  	cout<<"HH";
						  }
						  else if(a[i][j]==3)
						  {
						  	cout<<"N ";
						  }
						  else if(a[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(a[i][j]==9)
						  {
						  	
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<"GD";
						  }
						  else if(a[i][j]==8)
						  { SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"MM"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='a')
				{
					if(a[x+1][y-1]==8)
					{
						system("cls");
						system("color 0F");
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y-1]==0&&a[x+1][y]!=1)
					{
						a[x+1][y-1]=9;
						a[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
					{
						a[x-1][y-1]=9;
						a[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
				 } 
				else if(ch=='d')
				{
					if(a[x+1][y+1]==8)
					{
						system("cls");
						system("color 0F") ;
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
					{
						a[x+1][y+1]=9;
						a[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(a[x][y+1]==1)
					 {
					 	a[x-1][y+1]=9;
					 	a[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	a[x][y+1]=9;
					a[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&a[x-1][y]!=1&&(a[x][y+1]||a[x][y-1]==1)) 
				{
					a[x-1][y]=9;
					a[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&a[x+1][y]!=1&&(a[x][y+1]||a[x][y-1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x++;
					system("cls");
				}
				else
				{
					system("cls");
				}
				}
				return 0;
}

这个是对的

王子逸在2020-05-23 16:59:36追加了内容

另外s可以吧危险做掉

王子逸在2020-05-23 17:46:01追加了内容
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
using namespace std;
int main()
{
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int a[11][36]={{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
				  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1},
				  {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
				  {1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0},
				  {1,1,1,1,1,1,1,1,1,8,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},
				  {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}};

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(a[i][j]==1)
				  		{
						  SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  } 
						  
						  else if(a[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(a[i][j]==9)
						  {
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<"GD";
						  }
						  else if(a[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"MM"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='a')
				{
					if(a[x+1][y-1]==8)
					{
						system("cls");
						system("color 0F");
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y-1]==0&&a[x+1][y]!=1)
					{
						a[x+1][y-1]=9;
						a[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(a[x][y-1]==1&&a[x-1][y-1]!=1)
					{
						a[x-1][y-1]=9;
						a[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
				 } 
				else if(ch=='d')
				{
					if(a[x+1][y+1]==8)
					{
						system("cls");
						system("color 0F") ;
						cout<<"\n\n\n\n\t\t\t\t\tGame Over!\n\n\n\n\n\n\n";
						Sleep(5000);
						return 0;
					}
					else if(a[x+1][y+1]==0&&a[x-1][y+1]!=1)
					{
						a[x+1][y+1]=9;
						a[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(a[x][y+1]==1)
					 {
					 	a[x-1][y+1]=9;
					 	a[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	a[x][y+1]=9;
					a[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&a[x-1][y]!=1&&(a[x][y+1]||a[x][y-1]==1)) 
				{
					a[x-1][y]=9;
					a[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&a[x+1][y]!=1&&(a[x][y+1]||a[x][y-1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x++;
					system("cls");
				}
				else
				{
					system("cls");
				}
				}
				return 0;
}

在更一下,

流畅度增加


0
已采纳
余彦文
余彦文
初级光能
初级光能

建议加上


                else if(ch='s'){
                    if(a[x+1][y]!=1){
                        a[x+1][y]=9;
                        a[x][y]=0;
                        x++;
                    }
                    system("cls");
                }

我自己敲的,是向下走。

ps:

HH和N 是什么?

余彦文在2020-05-23 16:21:54追加了内容

因为你这个不是贪吃蛇一类的操控,所以w(跳跃)没什么用

余彦文在2020-05-23 16:32:57追加了内容

可以加上三维立体的地图

比如说有一个方块,你贴近它再移动一下会往上爬。

那地图就不是切面看了,是从上往下的平面组成

比如说

00000000 这是一张地图

02        00 0是墙

0        100 1是人

00000000 2是梯子

 

00000000 这是一张地图

021      00 0是墙

0          00 1是人

00000000 2是梯子

 

00000000 这是一张地图

021    000 0是墙

000      00 1是人

00000000 2是梯子

这时候切换到上一层

…………

余彦文在2020-05-24 10:16:01追加了内容

你这个还是切面的啊

不过也可以,挺棒的

可以做更多张地图,也可以做一张大地图

比如说

00000000000 这是一张地图

0    》1《     0 1是第一关

0       2         0 2是第二关

0       3         0 3是第三关

00000000000 这是目录,打错了对不起o_o

 

可以选地图

ps:建议把s(下降)加上

0
0
许金夫
许金夫
初级天翼
初级天翼

捧个场~你也到我那去捧个场呗

0
0
0
潘晨皓
潘晨皓
高级天翼
高级天翼

就是该怎么行走?

潘晨皓在2020-05-23 16:08:36追加了内容

怎么通关?

0
0
潘晨皓
潘晨皓
高级天翼
高级天翼

可以在上面行走!??!?!?!?!?!!?

我要回答