问题标题: 酷町堂:行走,活动更新,自定义皮肤价格增加,以后自定义皮肤会有限制哦

0
0
已解决
王子逸
王子逸
新手天翼
新手天翼
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
#include<string>
#include<ctime>
using namespace std;
double qi=100;
string ren="GD";
int b[11][36]={{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,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,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,8,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,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,1,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,4,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,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,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},
			   {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,1}};
int bf[11][36]={{1,0,0,0,0,0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,0,0},
				  {0,0,0,0,0,0,0,0,0,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,0,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}};
int huo()
{
	int zho;
	int xux;
	system("cls"); 
	while(1)
	{
		cout<<"\t\t\t\t活动\n\n\n";
	cout<<"\t\t\t王者之师皮肤活动!!!\n";
	cout<<"\t\t\t花费60金币进行一次抽奖!!\n";
	cout<<"\t\t有几率获得王者之师皮肤:□(来自王者的怒号)\n";
	cout<<"\t\t\t1.开始抽奖  2.退出\n\n你的选择:";
	cin>>xux;
	if(xux==1)
	{
		srand(time(NULL));
		zho=rand()%12+1;
		if(zho==2)
		{
			cout<<"\t\t欧皇啊!!!获得皮肤!!! □";
			ren="□";
		}
		else if(zho==1||zho==3||zho==4)
		{
			cout<<"\t\t\t获得70金币";
			qi+=70; 
		}
		else 
		{
			cout<<"\t\t\t没有中奖哦!!";
		}
		Sleep(2000);
		system("cls");
	}
	else
	{
		system("cls"); 
		return 1;
	}
	}
	
	 
}
int sh(){
string zidi;
	int jj;
	system("cls");
	cout<<"\t\t\t\t商城\n\n";
	cout<<"\t\t\t\t\金币:"<<qi<<endl; 
	cout<<"\t\t1.皮肤:QW  价格100(QwQ~呜)\n"; 
	cout<<"\t\t2.皮肤:MC  价格150(MC万岁)\n";
	cout<<"\t\t3.皮肤: OT  价格200(方块人)\n";
	cout<<"\t\t4.皮肤: .  价格250(小不点)\n";
	cout<<"\t\t5.皮肤:VC  价格300(dev c++)\n";
	cout<<"\t\t6.皮肤:自定义  价格700\n"; 
	cout<<"\t\t9.退出\n";
	cin>>jj;
	if(jj==1&&qi>=100)
	{
		qi-=100;
		ren="QW"; 
	}
	else if(jj==1&&qi<100)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900);
	}
	 if(jj==2&&qi>=150)
	{
		qi-=150;
		ren="MC";
	}
	else if(jj==2&&qi<150)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==3&&qi>=200)
	{
		qi-=200;
		ren="OT";
	}
	else if(jj==3&&qi<200)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==4&&qi>=250)
	{
		qi-=200;
		ren=" .";
	}
	else if(jj==4&&qi<250)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==5&&qi>=300)
	{
		qi-=200;
		ren="VC";
	}
	else if(jj==5&&qi<300)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==6&&qi>=700)
	{
		cout<<"自定义:";
		cin>>zidi;
		ren[1]=zidi[1];
		ren[0]=zidi[0];
		qi-=250;
	}
	else if(jj==6&&qi<700)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==9)
	{
		system("cls");
		return 1;
		
	 } 
	system("cls");
}
void suo()
{
	
	string ya="a键向左移动,d键向右移动,w爬墙,s下墙,z键在脚下放方块,f键打掉面前的方块";
	cout<<"\n\n\n\n\n\n\n\n\t\t";
	for(int i=0;i<ya.size();i++)
	{
		cout<<ya[i];
		Sleep(130);
	 }
	 for(int i=0;i<=10;i++)
	 {
	 	for(int j=0;j<=35;j++)
	 	{
	 		a[i][j]=af[i][j];
	 		b[i][j]=bf[i][j];
		 }
	 }
	 qi+=50;
	 cout<<"\n\n\t\t\t"; 
	 cout<<"加载中...";
	 cout<<"\n\t\t\t";
	 for(int i=1;i<=10;i++)
	 {
	 	cout<<"■"; 
	 	Sleep(500); 
	  } 
	 Sleep(1000);
	 system("cls");
}
	void gui(){
	cout<<"a键向左走,d键向右走\n";
	Sleep(1500);
	cout<<"w键爬墙,s键下墙\n";
	Sleep(1500);
	cout<<"f键挖掉面前的方块\n";
	Sleep(1500);
	cout<<"z键在脚下垫方块\n";
	Sleep(1500);
	cout<<"有主世界和神域两个世界,神域里一个是肉体,一个是灵魂\n";
	Sleep(3000);
	cout<<"每玩一局会获得50金币\n";
	Sleep(1500); 
	cout<<"活动中可以获得大量金币,有几率获得兑换码!!!";
	Sleep(2500);
	cout<<"版权所有,未经允许不得盗版,例:迷你世界盗版MC\n";
	Sleep(6000);
	system("cls"); 
}
int zhu()
{
	while(1){
	int xu;
	cout<<"\n\n\n\n\t\t\t|------------------------------------------------|\n";
	cout<<"\t\t\t|    1.新游戏      2  .规则     3.商城   4.活动  |\n";
	cout<<"\t\t\t|                                  作者——王子逸|\n";
	cout<<"\t\t\t|------------------------------------------------|\n\t\t选择:";
	cin>>xu;
	if(xu==1)
	{
		system("cls");
		suo(); 
		return 1;
	}
	else if(xu==2)
	{
		system("cls");
		gui(); 
	}
	else if(xu==3)
	{
		sh();
	 }  
	 else if(xu==4)
	 {
	 	huo();
	 }
	}
}
int tia()
{
	system("cls");
	HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    	HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
    	int f;
	char ch;					
	int x=3;
	int y=8;
	system("color 07");
	b[2][4]=0;
	while(1)
	{
		for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(b[i][j]==4)
				  		{
				  			cout<<"HH"; 
						  }
				  		else if (b[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else if(b[i][j]==1)
				  		{
						  SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  } 
						  
						  else if(b[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(b[i][j]==9)
						  {
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<ren;
						  }
						  else if(b[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
		
				ch=getch();
				if(ch=='f')
				{
					if(f==1)
					{
						b[x][y-1]=0;
					}
					else if(f==2)
					{
						b[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					 if(b[x][y-1]==6)
					{
					    a[2][5]=6;
						
						return 1;
						
					}
					 if(b[x+1][y-1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=1;
					
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y-1]==0&&b[x+1][y]!=1)
					{
						b[x+1][y-1]=9;
						b[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(b[x][y-1]==1&&b[x-1][y-1]!=1)
					{
						b[x-1][y-1]=9;
						b[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					b[x][y-1]=9;
					b[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&b[x-1][y]!=1)
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x][y]=1;
					b[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(b[x][y+1]==6)
					{a[2][5]=6;
						
						return 1;
						
					}
					else if(b[x+1][y+1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=2;
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y+1]==0&&b[x-1][y+1]!=1)
					{
						b[x+1][y+1]=9;
						b[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(b[x][y+1]==1)
					 {
					 	b[x-1][y+1]=9;
					 	b[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	b[x][y+1]=9;
					b[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&b[x-1][y]!=1&&(b[x][y+1]||b[x][y-1]==1)) 
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x-1][y]=9;
					b[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&b[x+1][y]!=1&&(b[x][y+1]==1||b[x][y-1]==1||b[x+1][y-1]==1||b[x+1][y+1]==1))
				{
					b[x+1][y]=9;
					b[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
			}
		}


int main()
{
	zhu(); 
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int f;

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if (a[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else 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<<ren;
						  }
						  else if(a[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='f')
				{
					if(f==1&&a[x][y-1]==1)
					{
						a[x][y-1]=0;
					}
					else if(f==2&&a[x][y+1]==1)
					{
						a[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					if(a[x][y-1]==6)
					{
						tia();
						y++;
					}
					f=1;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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 if(a[x][y-1]!=1&&a[x][y-1]!=8)
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
					else
					{
						system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					if(a[x-1][y]==6)
					{
						tia();
						y++;
					}
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(a[x][y+1]==6)
					{
						tia();
						a[x][y]=0;
						y+=2;
					}
					f=2;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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)) 
				{
					if(a[x-1][y]==6)
					{
						tia();
					}
					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]==1||a[x][y-1]==1||a[x+1][y-1]==1||a[x+1][y+1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
				}
				return 0;
}

                                             建议,和体验效果

王子逸在2020-05-28 13:21:03追加了内容

发了错误代码,抱歉,这是最新的!!! 

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
#include<string>
#include<ctime>
using namespace std;
double qi=100;
string ren="GD";
int b[11][36]={{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,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,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,8,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,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,1,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,4,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0},
		       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,0,0,0,0,0,0,0,0,0,0,0,0},
				  {0,0,0,0,0,6,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,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,1,0,0,0,0},
				  {0,0,0,0,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,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,0,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}};
int huo()
{
	int zho;
	int xux;
	system("cls"); 
	while(1)
	{
		cout<<"\t\t\t\t活动\n\n\n";
	cout<<"\t\t\t王者之师皮肤活动!!!\n";
	cout<<"\t\t\t花费60金币进行一次抽奖!!\n";
	cout<<"\t\t有几率获得王者之师皮肤:□(来自王者的怒号)\n";
	cout<<"\t\t\t1.开始抽奖  2.退出\n\n你的选择:";
	cin>>xux;
	if(xux==1)
	{
		qi-=60;
		srand(time(NULL));
		zho=rand()%12+1;
		if(zho==2)
		{
			cout<<"\t\t欧皇啊!!!获得皮肤!!! □";
			ren="□";
		}
		else if(zho==1||zho==3||zho==4)
		{
			cout<<"\t\t\t获得70金币";
			qi+=70; 
		}
		else 
		{
			cout<<"\t\t\t没有中奖哦!!";
		}
		Sleep(2000);
		system("cls");
	}
	else
	{
		system("cls"); 
		return 1;
	}
	}
	
	 
}
int sh(){
string zidi;
	int jj;
	system("cls");
	cout<<"\t\t\t\t商城\n\n";
	cout<<"\t\t\t\t\金币:"<<qi<<endl; 
	cout<<"\t\t1.皮肤:QW  价格100(QwQ~呜)\n"; 
	cout<<"\t\t2.皮肤:MC  价格150(MC万岁)\n";
	cout<<"\t\t3.皮肤: OT  价格200(方块人)\n";
	cout<<"\t\t4.皮肤: .  价格250(小不点)\n";
	cout<<"\t\t5.皮肤:VC  价格300(dev c++)\n";
	cout<<"\t\t6.皮肤:自定义  价格700\n"; 
	cout<<"\t\t9.退出\n";
	cin>>jj;
	if(jj==1&&qi>=100)
	{
		qi-=100;
		ren="QW"; 
	}
	else if(jj==1&&qi<100)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900);
	}
	 if(jj==2&&qi>=150)
	{
		qi-=150;
		ren="MC";
	}
	else if(jj==2&&qi<150)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==3&&qi>=200)
	{
		qi-=200;
		ren="OT";
	}
	else if(jj==3&&qi<200)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==4&&qi>=250)
	{
		qi-=200;
		ren=" .";
	}
	else if(jj==4&&qi<250)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==5&&qi>=300)
	{
		qi-=200;
		ren="VC";
	}
	else if(jj==5&&qi<300)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==6&&qi>=700)
	{
		cout<<"自定义:";
		cin>>zidi;
		ren[1]=zidi[1];
		ren[0]=zidi[0];
		qi-=250;
	}
	else if(jj==6&&qi<700)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==9)
	{
		system("cls");
		return 1;
		
	 } 
	system("cls");
}
void suo()
{
	
	string ya="a键向左移动,d键向右移动,w爬墙,s下墙,z键在脚下放方块,f键打掉面前的方块";
	cout<<"\n\n\n\n\n\n\n\n\t\t";
	for(int i=0;i<ya.size();i++)
	{
		cout<<ya[i];
		Sleep(130);
	 }
	 for(int i=0;i<=10;i++)
	 {
	 	for(int j=0;j<=35;j++)
	 	{
	 		a[i][j]=af[i][j];
	 		b[i][j]=bf[i][j];
		 }
	 }
	 qi+=50;
	 cout<<"\n\n\t\t\t"; 
	 cout<<"加载中...";
	 cout<<"\n\t\t\t";
	 for(int i=1;i<=10;i++)
	 {
	 	cout<<"■"; 
	 	Sleep(500); 
	  } 
	 Sleep(1000);
	 system("cls");
}
	void gui(){
	cout<<"a键向左走,d键向右走\n";
	Sleep(1500);
	cout<<"w键爬墙,s键下墙\n";
	Sleep(1500);
	cout<<"f键挖掉面前的方块\n";
	Sleep(1500);
	cout<<"z键在脚下垫方块\n";
	Sleep(1500);
	cout<<"有主世界和神域两个世界,神域里一个是肉体,一个是灵魂\n";
	Sleep(3000);
	cout<<"每玩一局会获得50金币\n";
	Sleep(1500); 
	cout<<"活动中可以获得大量金币,有几率获得兑换码!!!";
	Sleep(2500);
	cout<<"版权所有,未经允许不得盗版,例:迷你世界盗版MC\n";
	Sleep(6000);
	system("cls"); 
}
int zhu()
{
	while(1){
	int xu;
	cout<<"\n\n\n\n\t\t\t|------------------------------------------------|\n";
	cout<<"\t\t\t|    1.新游戏      2  .规则     3.商城   4.活动  |\n";
	cout<<"\t\t\t|                                  作者——王子逸|\n";
	cout<<"\t\t\t|------------------------------------------------|\n\t\t选择:";
	cin>>xu;
	if(xu==1)
	{
		system("cls");
		suo(); 
		return 1;
	}
	else if(xu==2)
	{
		system("cls");
		gui(); 
	}
	else if(xu==3)
	{
		sh();
	 }  
	 else if(xu==4)
	 {
	 	huo();
	 }
	}
}
int tia()
{
	system("cls");
	HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    	HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
    	int f;
	char ch;					
	int x=3;
	int y=8;
	system("color 07");
	b[2][4]=0;
	while(1)
	{
		for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(b[i][j]==4)
				  		{
				  			cout<<"HH"; 
						  }
				  		else if (b[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else if(b[i][j]==1)
				  		{
						  SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  } 
						  
						  else if(b[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(b[i][j]==9)
						  {
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<ren;
						  }
						  else if(b[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
		
				ch=getch();
				if(ch=='f')
				{
					if(f==1)
					{
						b[x][y-1]=0;
					}
					else if(f==2)
					{
						b[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					 if(b[x][y-1]==6)
					{
					    a[2][5]=6;
						
						return 1;
						
					}
					 if(b[x+1][y-1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=1;
					
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y-1]==0&&b[x+1][y]!=1)
					{
						b[x+1][y-1]=9;
						b[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(b[x][y-1]==1&&b[x-1][y-1]!=1)
					{
						b[x-1][y-1]=9;
						b[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					b[x][y-1]=9;
					b[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&b[x-1][y]!=1)
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x][y]=1;
					b[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(b[x][y+1]==6)
					{a[2][5]=6;
						
						return 1;
						
					}
					else if(b[x+1][y+1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=2;
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y+1]==0&&b[x-1][y+1]!=1)
					{
						b[x+1][y+1]=9;
						b[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(b[x][y+1]==1)
					 {
					 	b[x-1][y+1]=9;
					 	b[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	b[x][y+1]=9;
					b[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&b[x-1][y]!=1&&(b[x][y+1]||b[x][y-1]==1)) 
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x-1][y]=9;
					b[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&b[x+1][y]!=1&&(b[x][y+1]==1||b[x][y-1]==1||b[x+1][y-1]==1||b[x+1][y+1]==1))
				{
					b[x+1][y]=9;
					b[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
			}
		}


int main()
{
	zhu(); 
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int f;

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if (a[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else 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<<ren;
						  }
						  else if(a[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='f')
				{
					if(f==1&&a[x][y-1]==1)
					{
						a[x][y-1]=0;
					}
					else if(f==2&&a[x][y+1]==1)
					{
						a[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					if(a[x][y-1]==6)
					{
						tia();
						y++;
					}
					f=1;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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 if(a[x][y-1]!=1&&a[x][y-1]!=8)
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
					else
					{
						system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					if(a[x-1][y]==6)
					{
						tia();
						y++;
					}
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(a[x][y+1]==6)
					{
						tia();
						a[x][y]=0;
						y+=2;
					}
					f=2;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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)) 
				{
					if(a[x-1][y]==6)
					{
						tia();
					}
					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]==1||a[x][y-1]==1||a[x+1][y-1]==1||a[x+1][y+1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
				}
				return 0;
}

 

王子逸在2020-05-28 13:26:22追加了内容

修复一下bug!!!

 

 

 

 

 

 

 

 

 

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
#include<string>
#include<ctime>
using namespace std;
double qi=100;
string ren="GD";
int b[11][36]={{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,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,6,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,8,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0},
			   {0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0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	cout<<"\t\t\t王者之师皮肤活动!!!\n";
	cout<<"\t\t\t花费60金币进行一次抽奖!!\n";
	cout<<"\t\t有几率获得王者之师皮肤:□(来自王者的怒号)\n";
	cout<<"\t\t\t1.开始抽奖  2.退出\n\n你的选择:";
	cin>>xux;
	if(xux==1&&qi>=60)
	{
		qi-=60;
		srand(time(NULL));
		zho=rand()%12+1;
		if(zho==2)
		{
			cout<<"\t\t欧皇啊!!!获得皮肤!!! □";
			ren="□";
		}
		else if(zho==1||zho==3||zho==4)
		{
			cout<<"\t\t\t获得70金币";
			qi+=70; 
		}
		else 
		{
			cout<<"\t\t\t没有中奖哦!!";
		}
		Sleep(2000);
		system("cls");
	}
	else if(qi<60)
	{
		cout<<"\t\t\t金币不够了哦!!!" ; 
	}
	else
	{
		system("cls"); 
		return 1;
	}
	}
	
	 
}
int sh(){
string zidi;
	int jj;
	system("cls");
	cout<<"\t\t\t\t商城\n\n";
	cout<<"\t\t\t\t\金币:"<<qi<<endl; 
	cout<<"\t\t1.皮肤:QW  价格100(QwQ~呜)\n"; 
	cout<<"\t\t2.皮肤:MC  价格150(MC万岁)\n";
	cout<<"\t\t3.皮肤: OT  价格200(方块人)\n";
	cout<<"\t\t4.皮肤: .  价格250(小不点)\n";
	cout<<"\t\t5.皮肤:VC  价格300(dev c++)\n";
	cout<<"\t\t6.皮肤:自定义  价格700\n"; 
	cout<<"\t\t9.退出\n";
	cin>>jj;
	if(jj==1&&qi>=100)
	{
		qi-=100;
		ren="QW"; 
	}
	else if(jj==1&&qi<100)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900);
	}
	 if(jj==2&&qi>=150)
	{
		qi-=150;
		ren="MC";
	}
	else if(jj==2&&qi<150)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==3&&qi>=200)
	{
		qi-=200;
		ren="OT";
	}
	else if(jj==3&&qi<200)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==4&&qi>=250)
	{
		qi-=200;
		ren=" .";
	}
	else if(jj==4&&qi<250)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==5&&qi>=300)
	{
		qi-=200;
		ren="VC";
	}
	else if(jj==5&&qi<300)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==6&&qi>=700)
	{
		cout<<"自定义:";
		cin>>zidi;
		ren[1]=zidi[1];
		ren[0]=zidi[0];
		qi-=250;
	}
	else if(jj==6&&qi<700)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==9)
	{
		system("cls");
		return 1;
		
	 } 
	system("cls");
}
void suo()
{
	
	string ya="a键向左移动,d键向右移动,w爬墙,s下墙,z键在脚下放方块,f键打掉面前的方块";
	cout<<"\n\n\n\n\n\n\n\n\t\t";
	for(int i=0;i<ya.size();i++)
	{
		cout<<ya[i];
		Sleep(130);
	 }
	 for(int i=0;i<=10;i++)
	 {
	 	for(int j=0;j<=35;j++)
	 	{
	 		a[i][j]=af[i][j];
	 		b[i][j]=bf[i][j];
		 }
	 }
	 qi+=50;
	 cout<<"\n\n\t\t\t"; 
	 cout<<"加载中...";
	 cout<<"\n\t\t\t";
	 for(int i=1;i<=10;i++)
	 {
	 	cout<<"■"; 
	 	Sleep(500); 
	  } 
	 Sleep(1000);
	 system("cls");
}
	void gui(){
	cout<<"a键向左走,d键向右走\n";
	Sleep(1500);
	cout<<"w键爬墙,s键下墙\n";
	Sleep(1500);
	cout<<"f键挖掉面前的方块\n";
	Sleep(1500);
	cout<<"z键在脚下垫方块\n";
	Sleep(1500);
	cout<<"有主世界和神域两个世界,神域里一个是肉体,一个是灵魂\n";
	Sleep(3000);
	cout<<"每玩一局会获得50金币\n";
	Sleep(1500); 
	cout<<"活动中可以获得大量金币,有几率获得兑换码!!!";
	Sleep(2500);
	cout<<"版权所有,未经允许不得盗版,例:迷你世界盗版MC\n";
	Sleep(6000);
	system("cls"); 
}
int zhu()
{
	while(1){
	int xu;
	cout<<"\n\n\n\n\t\t\t|------------------------------------------------|\n";
	cout<<"\t\t\t|    1.新游戏      2  .规则     3.商城   4.活动  |\n";
	cout<<"\t\t\t|                                  作者——王子逸|\n";
	cout<<"\t\t\t|------------------------------------------------|\n\t\t选择:";
	cin>>xu;
	if(xu==1)
	{
		system("cls");
		suo(); 
		return 1;
	}
	else if(xu==2)
	{
		system("cls");
		gui(); 
	}
	else if(xu==3)
	{
		sh();
	 }  
	 else if(xu==4)
	 {
	 	huo();
	 }
	}
}
int tia()
{
	system("cls");
	HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    	HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
    	int f;
	char ch;					
	int x=3;
	int y=8;
	system("color 07");
	b[2][4]=0;
	while(1)
	{
		for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(b[i][j]==4)
				  		{
				  			cout<<"HH"; 
						  }
				  		else if (b[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else if(b[i][j]==1)
				  		{
						  SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  } 
						  
						  else if(b[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(b[i][j]==9)
						  {
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<ren;
						  }
						  else if(b[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
		
				ch=getch();
				if(ch=='f')
				{
					if(f==1)
					{
						b[x][y-1]=0;
					}
					else if(f==2)
					{
						b[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					 if(b[x][y-1]==6)
					{
					    a[2][5]=6;
						
						return 1;
						
					}
					 if(b[x+1][y-1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=1;
					
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y-1]==0&&b[x+1][y]!=1)
					{
						b[x+1][y-1]=9;
						b[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(b[x][y-1]==1&&b[x-1][y-1]!=1)
					{
						b[x-1][y-1]=9;
						b[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					b[x][y-1]=9;
					b[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&b[x-1][y]!=1)
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x][y]=1;
					b[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(b[x][y+1]==6)
					{a[2][5]=6;
						
						return 1;
						
					}
					else if(b[x+1][y+1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=2;
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y+1]==0&&b[x-1][y+1]!=1)
					{
						b[x+1][y+1]=9;
						b[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(b[x][y+1]==1)
					 {
					 	b[x-1][y+1]=9;
					 	b[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	b[x][y+1]=9;
					b[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&b[x-1][y]!=1&&(b[x][y+1]||b[x][y-1]==1)) 
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x-1][y]=9;
					b[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&b[x+1][y]!=1&&(b[x][y+1]==1||b[x][y-1]==1||b[x+1][y-1]==1||b[x+1][y+1]==1))
				{
					b[x+1][y]=9;
					b[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
			}
		}


int main()
{
	zhu(); 
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int f;

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if (a[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else 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<<ren;
						  }
						  else if(a[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='f')
				{
					if(f==1&&a[x][y-1]==1)
					{
						a[x][y-1]=0;
					}
					else if(f==2&&a[x][y+1]==1)
					{
						a[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					if(a[x][y-1]==6)
					{
						tia();
						y++;
					}
					f=1;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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 if(a[x][y-1]!=1&&a[x][y-1]!=8)
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
					else
					{
						system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					if(a[x-1][y]==6)
					{
						tia();
						y++;
					}
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(a[x][y+1]==6)
					{
						tia();
						a[x][y]=0;
						y+=2;
					}
					f=2;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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)) 
				{
					if(a[x-1][y]==6)
					{
						tia();
					}
					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]==1||a[x][y-1]==1||a[x+1][y-1]==1||a[x+1][y+1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
				}
				return 0;
}

 

王子逸在2020-05-28 13:29:50追加了内容

清屏OK 版本6.0!!!!

王子逸在2020-05-28 13:30:20追加了内容
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<conio.h>
#include<Windows.h>
#include<string>
#include<ctime>
using namespace std;
double qi=100;
string ren="GD";
int b[11][36]={{1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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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,0,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}};
int huo()
{
	int zho;
	int xux;
	system("cls"); 
	while(1)
	{
		cout<<"\t\t\t\t活动\n\n\n";
	cout<<"\t\t\t王者之师皮肤活动!!!\n";
	cout<<"\t\t\t花费60金币进行一次抽奖!!\n";
	cout<<"\t\t有几率获得王者之师皮肤:□(来自王者的怒号)\n";
	cout<<"\t\t\t1.开始抽奖  2.退出\n\n你的选择:";
	cin>>xux;
	if(xux==1&&qi>=60)
	{
		qi-=60;
		srand(time(NULL));
		zho=rand()%12+1;
		if(zho==2)
		{
			cout<<"\t\t欧皇啊!!!获得皮肤!!! □";
			ren="□";
		}
		else if(zho==1||zho==3||zho==4)
		{
			cout<<"\t\t\t获得70金币";
			qi+=70; 
		}
		else 
		{
			cout<<"\t\t\t没有中奖哦!!";
		}
		Sleep(2000);
		system("cls");
	}
	else if(qi<60)
	{
		cout<<"\t\t\t金币不够了哦!!!" ; 
		system("cls");
	}
	else
	{
		system("cls"); 
		return 1;
	}
	}
	
	 
}
int sh(){
string zidi;
	int jj;
	system("cls");
	cout<<"\t\t\t\t商城\n\n";
	cout<<"\t\t\t\t\金币:"<<qi<<endl; 
	cout<<"\t\t1.皮肤:QW  价格100(QwQ~呜)\n"; 
	cout<<"\t\t2.皮肤:MC  价格150(MC万岁)\n";
	cout<<"\t\t3.皮肤: OT  价格200(方块人)\n";
	cout<<"\t\t4.皮肤: .  价格250(小不点)\n";
	cout<<"\t\t5.皮肤:VC  价格300(dev c++)\n";
	cout<<"\t\t6.皮肤:自定义  价格700\n"; 
	cout<<"\t\t9.退出\n";
	cin>>jj;
	if(jj==1&&qi>=100)
	{
		qi-=100;
		ren="QW"; 
	}
	else if(jj==1&&qi<100)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900);
	}
	 if(jj==2&&qi>=150)
	{
		qi-=150;
		ren="MC";
	}
	else if(jj==2&&qi<150)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==3&&qi>=200)
	{
		qi-=200;
		ren="OT";
	}
	else if(jj==3&&qi<200)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==4&&qi>=250)
	{
		qi-=200;
		ren=" .";
	}
	else if(jj==4&&qi<250)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==5&&qi>=300)
	{
		qi-=200;
		ren="VC";
	}
	else if(jj==5&&qi<300)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	if(jj==6&&qi>=700)
	{
		cout<<"自定义:";
		cin>>zidi;
		ren[1]=zidi[1];
		ren[0]=zidi[0];
		qi-=250;
	}
	else if(jj==6&&qi<700)
	{
		cout<<"没钱买什么皮肤?";
		Sleep(1900); 
	}
	 if(jj==9)
	{
		system("cls");
		return 1;
		
	 } 
	system("cls");
}
void suo()
{
	
	string ya="a键向左移动,d键向右移动,w爬墙,s下墙,z键在脚下放方块,f键打掉面前的方块";
	cout<<"\n\n\n\n\n\n\n\n\t\t";
	for(int i=0;i<ya.size();i++)
	{
		cout<<ya[i];
		Sleep(130);
	 }
	 for(int i=0;i<=10;i++)
	 {
	 	for(int j=0;j<=35;j++)
	 	{
	 		a[i][j]=af[i][j];
	 		b[i][j]=bf[i][j];
		 }
	 }
	 qi+=50;
	 cout<<"\n\n\t\t\t"; 
	 cout<<"加载中...";
	 cout<<"\n\t\t\t";
	 for(int i=1;i<=10;i++)
	 {
	 	cout<<"■"; 
	 	Sleep(500); 
	  } 
	 Sleep(1000);
	 system("cls");
}
	void gui(){
	cout<<"a键向左走,d键向右走\n";
	Sleep(1500);
	cout<<"w键爬墙,s键下墙\n";
	Sleep(1500);
	cout<<"f键挖掉面前的方块\n";
	Sleep(1500);
	cout<<"z键在脚下垫方块\n";
	Sleep(1500);
	cout<<"有主世界和神域两个世界,神域里一个是肉体,一个是灵魂\n";
	Sleep(3000);
	cout<<"每玩一局会获得50金币\n";
	Sleep(1500); 
	cout<<"活动中可以获得大量金币,有几率获得兑换码!!!";
	Sleep(2500);
	cout<<"版权所有,未经允许不得盗版,例:迷你世界盗版MC\n";
	Sleep(6000);
	system("cls"); 
}
int zhu()
{
	while(1){
	int xu;
	cout<<"\n\n\n\n\t\t\t|------------------------------------------------|\n";
	cout<<"\t\t\t|    1.新游戏      2  .规则     3.商城   4.活动  |\n";
	cout<<"\t\t\t|                                  作者——王子逸|\n";
	cout<<"\t\t\t|------------------------------------------------|\n\t\t选择:";
	cin>>xu;
	if(xu==1)
	{
		system("cls");
		suo(); 
		return 1;
	}
	else if(xu==2)
	{
		system("cls");
		gui(); 
	}
	else if(xu==3)
	{
		sh();
	 }  
	 else if(xu==4)
	 {
	 	huo();
	 }
	}
}
int tia()
{
	system("cls");
	HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    	HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
    	int f;
	char ch;					
	int x=3;
	int y=8;
	system("color 07");
	b[2][4]=0;
	while(1)
	{
		for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if(b[i][j]==4)
				  		{
				  			cout<<"HH"; 
						  }
				  		else if (b[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else if(b[i][j]==1)
				  		{
						  SetConsoleTextAttribute(hstdout, 0x0C);
				  			cout<<"OT";
						  } 
						  
						  else if(b[i][j]==0)
						  {
						  	cout<<"  ";
						  }
						  else if(b[i][j]==9)
						  {
    						SetConsoleTextAttribute(hstdout, 0x0E);
					   	  	cout<<ren;
						  }
						  else if(b[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
		
				ch=getch();
				if(ch=='f')
				{
					if(f==1)
					{
						b[x][y-1]=0;
					}
					else if(f==2)
					{
						b[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					 if(b[x][y-1]==6)
					{
					    a[2][5]=6;
						
						return 1;
						
					}
					 if(b[x+1][y-1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=1;
					
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y-1]==0&&b[x+1][y]!=1)
					{
						b[x+1][y-1]=9;
						b[x][y]=0;
						x++;
						y--;
						system("cls");
					}
					else if(b[x][y-1]==1&&b[x-1][y-1]!=1)
					{
						b[x-1][y-1]=9;
						b[x][y]=0;
						x--;
						y--;
						system("cls");
					}
					else
					{
					b[x][y-1]=9;
					b[x][y]=0;
					y--;
					system("cls");
					}
				}
				else if(ch=='z'&&b[x-1][y]!=1)
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x][y]=1;
					b[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(b[x][y+1]==6)
					{a[2][5]=6;
						
						return 1;
						
					}
					else if(b[x+1][y+1]==4)
					{
						b[x-4][y]==9;
						b[x][y]=0;
						x-=4;
						system("cls");
					}
					f=2;
					 if(b[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(2000);
						system("cls");
						zhu();
						x=3;
						y=8;
					}
					else if(b[x+1][y+1]==0&&b[x-1][y+1]!=1)
					{
						b[x+1][y+1]=9;
						b[x][y]=0;
						x++;
						y++;
						system("cls");
					 } 
					 else if(b[x][y+1]==1)
					 {
					 	b[x-1][y+1]=9;
					 	b[x][y]=0;
					 	x--;
					 	y++;
					 	system("cls");
					 }
					 
					 else
					 {
					 	b[x][y+1]=9;
					b[x][y]=0;
					y++;
					system("cls");
					 }
					
				}
				else if(ch=='w'&&b[x-1][y]!=1&&(b[x][y+1]||b[x][y-1]==1)) 
				{
					if(b[x-1][y]==6)
					{
						tia();
					}
					b[x-1][y]=9;
					b[x][y]=0;
					x--;
					system("cls");
				}
				else if(ch=='s'&&b[x+1][y]!=1&&(b[x][y+1]==1||b[x][y-1]==1||b[x+1][y-1]==1||b[x+1][y+1]==1))
				{
					b[x+1][y]=9;
					b[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
			}
		}


int main()
{
	zhu(); 
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
    						HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
	system("color 04");
	int x=8,y=31;
	char ch;
	int f;

				  while(1)
				  {
				for(int i=0;i<=10;i++)
				{
				  	for(int j=0;j<=35;j++)
				  	{
				  		if (a[i][j]==6)
				  		{
				  			cout<<" @";
						  }
				  		else 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<<ren;
						  }
						  else if(a[i][j]==8)
						  { 
						  SetConsoleTextAttribute(hstdout, 0x0F);
						  	cout<<"AA"; 
						  }
					  }
					  cout<<endl; 
				}
				ch=getch();
				if(ch=='f')
				{
					if(f==1&&a[x][y-1]==1)
					{
						a[x][y-1]=0;
					}
					else if(f==2&&a[x][y+1]==1)
					{
						a[x][y+1]=0;
					}
					system("cls");
				}
				else if(ch=='a')
				{
					if(a[x][y-1]==6)
					{
						tia();
						y++;
					}
					f=1;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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 if(a[x][y-1]!=1&&a[x][y-1]!=8)
					{
					a[x][y-1]=9;
					a[x][y]=0;
					y--;
					system("cls");
					}
					else
					{
						system("cls");
					}
				}
				else if(ch=='z'&&a[x-1][y]!=1)
				{
					if(a[x-1][y]==6)
					{
						tia();
						y++;
					}
					a[x][y]=1;
					a[x-1][y]=9;
					x-=1;
					system("cls"); 
					
				 } 
				else if(ch=='d')
				{
					if(a[x][y+1]==6)
					{
						tia();
						a[x][y]=0;
						y+=2;
					}
					f=2;
					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(2000);
						system("cls");
						zhu();
						x=8;
						y=31;
					}
					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)) 
				{
					if(a[x-1][y]==6)
					{
						tia();
					}
					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]==1||a[x][y-1]==1||a[x+1][y-1]==1||a[x+1][y+1]==1))
				{
					a[x+1][y]=9;
					a[x][y]=0;
					x++;
					system("cls");
				} 
				else 
				{
					system("cls");
				}
				}
				return 0;
}

 


0
已采纳
吕若朴
吕若朴
中级光能
中级光能

我来了!

吕若朴在2020-05-28 17:37:36追加了内容

还是把皮肤搞多一点,建议皮肤便宜一点,ok?

0
0
董宇昊
董宇昊
初级启示者
初级启示者

你的游戏我现在都不知道怎么玩

0
金棕乐
金棕乐
初级守护
初级守护

如果在神域一直搭方块会坏了

我要回答