devc++跑酷游戏2.0.0

又更新了两关,我的地图都是我徒手在方格纸上画再到程序中调整的,怎么办没有关卡更新了,下一次可能要一周时间更新

废话结束正文开始:

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
using namespace std;
int a,a1,b,b1,gb,c,d;
int cd1,cd2,tc;
int ax;
char rw='@';
//1.新手教程  2.蹦床世界   3.明枪易躲,暗箭难防   4.明枪易躲,暗箭难防(2) 
string mapp1[4][25]={
	{
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"         -----  --  -- - -----                   |",
		"    -                                            |",
		"---- --                                          |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"----^--=                                         |",
		"                                   ---=          |",
		"                                                 |",
		"                                              |- |",	
		"                                               $ |",
		"                                             ----|",
		"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
	},
	{
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                               ==^               |",
		"                                      -  --^     |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                              ==^                |",
		"              --- <                              |",
		"               <                                 |",
		"            ---                                  |", 
		"          --                                     |",
		"        --                                      ^|",
		"--^ ----               -                      ^ $|", 
		"                         ----=                >--|",
		"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
	},
	{
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"    ==-                                          |",
		"           ^===^    > <    -                     |",
		"           <    > >    <                         |",
		"                  >    <                         |",
		"                       <                         |",
		"                                                 |",
		"           -----                                 |",
		"  ==                                             |",
		"                                                 |",
		"                -=-=-==----                     $|",
		"                                               --|",
		"                                                 |", 
		"             ===                                 |",
		"                                    >     <      |", 
		"-==                                  ^---^  ==   |", 
		"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",   
	},
	{
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                              ------        ---  |",
		"                             -       ---  --   ^ |",
		"                       <--->                     |",
		"    <->             --                        <^ |",
		"                  --                           <$|",
		"  =^    <->                                     <|",
		" =            ---^                               |",
		"                                  ^              |",
		"                                  |              |",
		"                                 <|=             |",
		"                                   <             |",
		"                                    >            |",
		" >                                   ---^<^--^-  |",
		"= -- -- - -- --- -- - --- ---                  - |",
		"                              --                 |",
		"                                                 |",
		"                                                 |",
		"                                                 |",
		"                                   ^   ^         |",
		"                             <>   < >  >         |",
		"----^--^-^----^^^---^^-^^^--=  ---   --  ---^---=|",
		"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
	} 
	};
void sb_ycksbj();

void sb_yd(int x,int y);

void sb_yc();

void g1();

void g2();

void sb_ycksbj()
{
	HANDLE hStdin=GetStdHandle(STD_INPUT_HANDLE);
	DWORD mode;
	GetConsoleMode(hStdin,&mode);
	mode&=~ENABLE_QUICK_EDIT_MODE; //移除快速编辑模式
	mode&=~ENABLE_INSERT_MODE; //移除插入模式
	mode&=~ENABLE_MOUSE_INPUT;
	SetConsoleMode(hStdin, mode);
}
void sb_yd(int x,int y)  //光标移动到x,y
{
	HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
	COORD pos;
	pos.X=x;
	pos.Y=y;
	SetConsoleCursorPosition(handle,pos);
}
void sb_yc()
{
	HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_CURSOR_INFO CursorInfo;
	GetConsoleCursorInfo(handle,&CursorInfo);//获取控制台光标信息
	CursorInfo.bVisible=false; //隐藏控制台光标
	SetConsoleCursorInfo(handle,&CursorInfo);//设置控制台光标状态
}
void gq_sx(int x,int y,char z,int l)
{
	system("cls");
	sb_ycksbj();
	sb_yc();
	system("title 跑酷游戏");
	system("mode con cols=50 lines=25");
	sb_yd(0,0);
	for(int i=0;i<24;i++)
	{
	cout<<mapp1[l][i]<<endl;
	}
	cout<<mapp1[l][24];
	sb_yd(x,y);
	cout<<z;
	return;
} 
void gq_yx(int x,int y,char z,int l)
{
	int x1=x,yy1=y,ax;
	sb_yd(x1,yy1);
	cout<<z;
	for(;;)
	{
		if(kbhit()!=0)
		{
			ax=getch();
			if(ax==224)
			{
				ax=getch();
				if(ax==72)
				{
					for(int j=1;j<=4;j++)
					{
						_sleep(100);
						if(yy1!=0&&mapp1[l][yy1-1][x1]==' '||mapp1[l][yy1-1][x1]=='$'&&mapp1[l][yy1-1][x1]!='|')
						{
							sb_yd(x1,yy1);
							cout<<" ";
							yy1--;
							sb_yd(x1,yy1);
							cout<<z;
							if(kbhit()!=0)
							{
								ax=getch();
								if(ax==224)
								{
									ax=getch();
									if(ax==75)
									{
										if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
										{
											x1--;
											sb_yd(x1,yy1);
											cout<<z<<" ";
										}
									}
									if(ax==77)
									{
										if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
										{
											sb_yd(x1,yy1);
											cout<<" "<<z;
											x1++;
										}
									}
								}
								if(ax==122||ax==90)
								{
									system("cls");
									gq_sx(x,y,z,l);
								}
								
							} 
						}
					}
				}
				if(ax==75)
				{
					if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
					{
						x1--;
						sb_yd(x1,yy1);
						cout<<z<<" ";
					}
				}
				if(ax==77)
				{
					if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
					{
						sb_yd(x1,yy1);
						cout<<" "<<z;
						x1++;
					}
				}
			}
			if(ax==122||ax==90)
			{
				system("cls");
				gq_sx(x,y,z,l);
			}
		}
 		while(mapp1[l][yy1+1][x1]==' '||mapp1[l][yy1+1][x1]=='$')
		{
			_sleep(100);
	 		sb_yd(x1,yy1);
			cout<<" ";
			yy1+=1;
	 		sb_yd(x1,yy1);
	 		cout<<z;
	 		if(kbhit()!=0)
			{
				ax=getch();
				if(ax==224)
				{
					ax=getch();
					if(ax==75)
					{
						if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
						{
							x1--;
							sb_yd(x1,yy1);
							cout<<z<<" ";
						}
					}
					if(ax==77)
					{
						if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
						{
							sb_yd(x1,yy1);
							cout<<" "<<z;
							x1++;
						}
					}
				}
				if(ax==122||ax==90)
				{
					system("cls");
					gq_sx(x,y,z,l);
				}
			}
			if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>')
			{
				sb_yd(x1,yy1);
				cout<<" ";
				x1=x;
				yy1=y;
				sb_yd(x1,yy1);
				cout<<z;
			} 
		} 
		if(mapp1[l][yy1+1][x1]=='=')
	 	{
	 		int jc=1;
			for(int j=1;j<=8;j++)
	 		{
	 			if(mapp1[l][yy1-1][x1]==' ')
	 			{
	 				_sleep(10);
					sb_yd(x1,yy1);
					cout<<" ";
					yy1--;
					sb_yd(x1,yy1);
					cout<<z;
					if(kbhit()!=0)
					{
						ax=getch();
						if(ax==224)
						{
							ax=getch();
							if(ax==75)
							{
								if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
								{
									x1--;
									sb_yd(x1,yy1);
									cout<<z<<" ";
								}
							}
							if(ax==77)
							{
								if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
								{
									sb_yd(x1,yy1);
									cout<<" "<<z;
									x1++;
								}
							}
						}
						if(ax==122||ax==90)
						{
							system("cls");
							gq_sx(x,y,z,l);
						}
					} 
				}
				if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>')
				{
					sb_yd(x1,yy1);
					cout<<" ";
					x1=x;
					yy1=y;
					sb_yd(x1,yy1);
					cout<<z;
				}
			} 
		}	
		if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>')
		{
			sb_yd(x1,yy1);
			cout<<" ";
			x1=x;
			yy1=y;
			sb_yd(x1,yy1);
			cout<<z;
		}
		if(mapp1[l][yy1][x1]=='$')
		{
			_sleep(10);
			system("cls");
			sb_yd(0,0);
			cout<<"你赢了!"<<endl;
			cout<<"按空格返回。";
			if(getch()==' ')
			{
				system("cls");
				sb_yd(0,0);
				return;
			}
		}
	}
}
void g1()
{
	cout<<endl<<endl;
	cout<<"\n\n\n\n\n\n\n\n\n                第一关:新手教程。";
	cout<<endl<<endl;
	_sleep(500);
	system("cls");
	for(int i=0;i<24;i++)
	{
		cout<<mapp1[0][i]<<endl;
	}
	cout<<mapp1[0][24];
	gq_yx(0,17,rw,0);
	return;
}
void g2()
{
	cout<<endl<<endl;
	cout<<"\n\n\n\n\n\n\n\n\n                第二关:蹦床世界。"<<endl; 
	cout<<endl<<endl;
	_sleep(500);
	system("cls");
	for(int i=0;i<24;i++)
	{
		cout<<mapp1[1][i]<<endl;
	}
	cout<<mapp1[1][24];
	gq_yx(0,21,rw,1);
	return;
}
void g3()
{
	cout<<endl<<endl;
	cout<<"\n\n\n\n\n\n\n\n\n          第三关:明枪易躲,暗箭难防(1)。"<<endl; 
	cout<<endl<<endl;
	_sleep(500);
	system("cls");
	for(int i=0;i<24;i++)
	{
		cout<<mapp1[2][i]<<endl;
	}
	cout<<mapp1[2][24];
	gq_yx(0,22,rw,2);
	return;
}
void g4()
{
	cout<<endl<<endl;
	cout<<"\n\n\n\n\n\n\n\n\n          第四关:明枪易躲,暗箭难防(2)。"<<endl; 
	cout<<endl<<endl;
	_sleep(500);
	system("cls");
	for(int i=0;i<24;i++)
	{
		cout<<mapp1[3][i]<<endl;
	}
	cout<<mapp1[3][24];
	gq_yx(0,22,rw,3);
	return;
}
int hy()
{
	if(c==0)
	{
		cout<<"\n\n\n\n\n\n\n\n\n\n\n\n           ============欢迎============           "<<endl;
		c++;
		_sleep(1000);
		srand(time(0));
		system("cls");
	}
	cout<<"\n\n\n\n\n\n\n                       首页\n\n\n\n\n";
	cout<<"                     1.开始游戏\n\n\n\n";
	cout<<"                      2.退出";
	a=0;
	a=getch()-'0';
	return a;
}
void gq()
{ 
	for(;;) 
	{
		cout<<"\n\n\n\n\n\n                        关卡\n\n\n"<<endl;
		cout<<"              1.新手教程   2.蹦床世界\n\n"<<endl; 
		cout<<"              3.明枪易躲,暗箭难防(1)\n\n"<<endl;
		cout<<"              4.明枪易躲,暗箭难防(2)\n\n"<<endl;
		cout<<"                      5.退出";
		a=getch()-'0';
		switch(a)
		{
			case 1 :
			{
				system("cls");
				g1();	
				break;	
			}
			case 2 :
			{
				system("cls");
				g2();	
				break;	
			}
			case 3 :
			{
				system("cls");
				g3();
			}
			case 4 :
			{
				system("cls");
				g4();
			}
			case 5 :
			{
				system("cls");
				tc=1;
				break;	
			}
			default:
			{
				system("cls");
				cout<<"\n\n\n\n\n\n\n\n\n\n\n\n             请输入正确的字符!!!";
				system("cls");
				continue;
				
			}
		}
		if(tc==1)
		{
			tc=0;
			break;
		}
	}
	system("cls");
	return ;
}
int main()
{
	sb_ycksbj();
	sb_yc();
	system("title 跑酷游戏");
	system("mode con cols=50 lines=25");
	for(;;)
	{
		hy();
		if(a==1||a==2)
		{
		if(a==1)
		{
			system("cls");
			gq();
		}
		if(a==2)
		{
				system("cls");
				cout<<endl<<endl<<"    再见!    "<<endl<<endl;
				_sleep(750);
				system("cls");
				exit(0);
		}
		}
		else
		{
			system("cls");
			cout<<"\n\n\n\n\n\n\n\n\n\n\n\n             请输入正确的字符!!!";
			system("cls");
			continue;
		}
	}
}

-------------------------------------------------------《华丽的分界线》--------------------------------------------------

为了体贴一些没有账号或退出登录的用户,下面再复制一份,可能看起来有亿点点变形:

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
using namespace std;
int a,a1,b,b1,gb,c,d;
int cd1,cd2,tc;
int ax;
char rw='@';
//1.新手教程  2.蹦床世界   3.明枪易躲,暗箭难防   4.明枪易躲,暗箭难防(2) 
string mapp1[4][25]={
    {
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "         -----  --  -- - -----                   |",
        "    -                                            |",
        "---- --                                          |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "----^--=                                         |",
        "                                   ---=          |",
        "                                                 |",
        "                                              |- |",    
        "                                               $ |",
        "                                             ----|",
        "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
    },
    {
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                               ==^               |",
        "                                      -  --^     |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                              ==^                |",
        "              --- <                              |",
        "               <                                 |",
        "            ---                                  |", 
        "          --                                     |",
        "        --                                      ^|",
        "--^ ----               -                      ^ $|", 
        "                         ----=                >--|",
        "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
    },
    {
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "    ==-                                          |",
        "           ^===^    > <    -                     |",
        "           <    > >    <                         |",
        "                  >    <                         |",
        "                       <                         |",
        "                                                 |",
        "           -----                                 |",
        "  ==                                             |",
        "                                                 |",
        "                -=-=-==----                     $|",
        "                                               --|",
        "                                                 |", 
        "             ===                                 |",
        "                                    >     <      |", 
        "-==                                  ^---^  ==   |", 
        "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",   
    },
    {
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                              ------        ---  |",
        "                             -       ---  --   ^ |",
        "                       <--->                     |",
        "    <->             --                        <^ |",
        "                  --                           <$|",
        "  =^    <->                                     <|",
        " =            ---^                               |",
        "                                  ^              |",
        "                                  |              |",
        "                                 <|=             |",
        "                                   <             |",
        "                                    >            |",
        " >                                   ---^<^--^-  |",
        "= -- -- - -- --- -- - --- ---                  - |",
        "                              --                 |",
        "                                                 |",
        "                                                 |",
        "                                                 |",
        "                                   ^   ^         |",
        "                             <>   < >  >         |",
        "----^--^-^----^^^---^^-^^^--=  ---   --  ---^---=|",
        "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",
    } 
    };
void sb_ycksbj();

void sb_yd(int x,int y);

void sb_yc();

void g1();

void g2();

void sb_ycksbj()
{
    HANDLE hStdin=GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin,&mode);
    mode&=~ENABLE_QUICK_EDIT_MODE; //移除快速编辑模式
    mode&=~ENABLE_INSERT_MODE; //移除插入模式
    mode&=~ENABLE_MOUSE_INPUT;
    SetConsoleMode(hStdin, mode);
}
void sb_yd(int x,int y)  //光标移动到x,y
{
    HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD pos;
    pos.X=x;
    pos.Y=y;
    SetConsoleCursorPosition(handle,pos);
}
void sb_yc()
{
    HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(handle,&CursorInfo);//获取控制台光标信息
    CursorInfo.bVisible=false; //隐藏控制台光标
    SetConsoleCursorInfo(handle,&CursorInfo);//设置控制台光标状态
}
void gq_sx(int x,int y,char z,int l)
{
    system("cls");
    sb_ycksbj();
    sb_yc();
    system("title 跑酷游戏");
    system("mode con cols=50 lines=25");
    sb_yd(0,0);
    for(int i=0;i<24;i++)
    {
    cout<<mapp1[l][i]<<endl;
    }
    cout<<mapp1[l][24];
    sb_yd(x,y);
    cout<<z;
    return;

void gq_yx(int x,int y,char z,int l)
{
    int x1=x,yy1=y,ax;
    sb_yd(x1,yy1);
    cout<<z;
    for(;;)
    {
        if(kbhit()!=0)
        {
            ax=getch();
            if(ax==224)
            {
                ax=getch();
                if(ax==72)
                {
                    for(int j=1;j<=4;j++)
                    {
                        _sleep(100);
                        if(yy1!=0&&mapp1[l][yy1-1][x1]==' '||mapp1[l][yy1-1][x1]=='$'&&mapp1[l][yy1-1][x1]!='|')
                        {
                            sb_yd(x1,yy1);
                            cout<<" ";
                            yy1--;
                            sb_yd(x1,yy1);
                            cout<<z;
                            if(kbhit()!=0)
                            {
                                ax=getch();
                                if(ax==224)
                                {
                                    ax=getch();
                                    if(ax==75)
                                    {
                                        if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
                                        {
                                            x1--;
                                            sb_yd(x1,yy1);
                                            cout<<z<<" ";
                                        }
                                    }
                                    if(ax==77)
                                    {
                                        if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
                                        {
                                            sb_yd(x1,yy1);
                                            cout<<" "<<z;
                                            x1++;
                                        }
                                    }
                                }
                                if(ax==122||ax==90)
                                {
                                    system("cls");
                                    gq_sx(x,y,z,l);
                                }
                                
                            } 
                        }
                    }
                }
                if(ax==75)
                {
                    if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
                    {
                        x1--;
                        sb_yd(x1,yy1);
                        cout<<z<<" ";
                    }
                }
                if(ax==77)
                {
                    if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
                    {
                        sb_yd(x1,yy1);
                        cout<<" "<<z;
                        x1++;
                    }
                }
            }
            if(ax==122||ax==90)
            {
                system("cls");
                gq_sx(x,y,z,l);
            }
        }
         while(mapp1[l][yy1+1][x1]==' '||mapp1[l][yy1+1][x1]=='$')
        {
            _sleep(100);
             sb_yd(x1,yy1);
            cout<<" ";
            yy1+=1;
             sb_yd(x1,yy1);
             cout<<z;
             if(kbhit()!=0)
            {
                ax=getch();
                if(ax==224)
                {
                    ax=getch();
                    if(ax==75)
                    {
                        if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
                        {
                            x1--;
                            sb_yd(x1,yy1);
                            cout<<z<<" ";
                        }
                    }
                    if(ax==77)
                    {
                        if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
                        {
                            sb_yd(x1,yy1);
                            cout<<" "<<z;
                            x1++;
                        }
                    }
                }
                if(ax==122||ax==90)
                {
                    system("cls");
                    gq_sx(x,y,z,l);
                }
            }
            if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>')
            {
                sb_yd(x1,yy1);
                cout<<" ";
                x1=x;
                yy1=y;
                sb_yd(x1,yy1);
                cout<<z;
            } 
        } 
        if(mapp1[l][yy1+1][x1]=='=')
         {
             int jc=1;
            for(int j=1;j<=8;j++)
             {
                 if(mapp1[l][yy1-1][x1]==' ')
                 {
                     _sleep(10);
                    sb_yd(x1,yy1);
                    cout<<" ";
                    yy1--;
                    sb_yd(x1,yy1);
                    cout<<z;
                    if(kbhit()!=0)
                    {
                        ax=getch();
                        if(ax==224)
                        {
                            ax=getch();
                            if(ax==75)
                            {
                                if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$'&&mapp1[l][yy1][x1-1]!='|')
                                {
                                    x1--;
                                    sb_yd(x1,yy1);
                                    cout<<z<<" ";
                                }
                            }
                            if(ax==77)
                            {
                                if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$'&&mapp1[l][yy1][x1+1]!='|')
                                {
                                    sb_yd(x1,yy1);
                                    cout<<" "<<z;
                                    x1++;
                                }
                            }
                        }
                        if(ax==122||ax==90)
                        {
                            system("cls");
                            gq_sx(x,y,z,l);
                        }
                    } 
                }
                if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>')
                {
                    sb_yd(x1,yy1);
                    cout<<" ";
                    x1=x;
                    yy1=y;
                    sb_yd(x1,yy1);
                    cout<<z;
                }
            } 
        }    
        if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>')
        {
            sb_yd(x1,yy1);
            cout<<" ";
            x1=x;
            yy1=y;
            sb_yd(x1,yy1);
            cout<<z;
        }
        if(mapp1[l][yy1][x1]=='$')
        {
            _sleep(10);
            system("cls");
            sb_yd(0,0);
            cout<<"你赢了!"<<endl;
            cout<<"按空格返回。";
            if(getch()==' ')
            {
                system("cls");
                sb_yd(0,0);
                return;
            }
        }
    }
}
void g1()
{
    cout<<endl<<endl;
    cout<<"\n\n\n\n\n\n\n\n\n                第一关:新手教程。";
    cout<<endl<<endl;
    _sleep(500);
    system("cls");
    for(int i=0;i<24;i++)
    {
        cout<<mapp1[0][i]<<endl;
    }
    cout<<mapp1[0][24];
    gq_yx(0,17,rw,0);
    return;
}
void g2()
{
    cout<<endl<<endl;
    cout<<"\n\n\n\n\n\n\n\n\n                第二关:蹦床世界。"<<endl; 
    cout<<endl<<endl;
    _sleep(500);
    system("cls");
    for(int i=0;i<24;i++)
    {
        cout<<mapp1[1][i]<<endl;
    }
    cout<<mapp1[1][24];
    gq_yx(0,21,rw,1);
    return;
}
void g3()
{
    cout<<endl<<endl;
    cout<<"\n\n\n\n\n\n\n\n\n          第三关:明枪易躲,暗箭难防(1)。"<<endl; 
    cout<<endl<<endl;
    _sleep(500);
    system("cls");
    for(int i=0;i<24;i++)
    {
        cout<<mapp1[2][i]<<endl;
    }
    cout<<mapp1[2][24];
    gq_yx(0,22,rw,2);
    return;
}
void g4()
{
    cout<<endl<<endl;
    cout<<"\n\n\n\n\n\n\n\n\n          第四关:明枪易躲,暗箭难防(2)。"<<endl; 
    cout<<endl<<endl;
    _sleep(500);
    system("cls");
    for(int i=0;i<24;i++)
    {
        cout<<mapp1[3][i]<<endl;
    }
    cout<<mapp1[3][24];
    gq_yx(0,22,rw,3);
    return;
}
int hy()
{
    if(c==0)
    {
        cout<<"\n\n\n\n\n\n\n\n\n\n\n\n           ============欢迎============           "<<endl;
        c++;
        _sleep(1000);
        srand(time(0));
        system("cls");
    }
    cout<<"\n\n\n\n\n\n\n                       首页\n\n\n\n\n";
    cout<<"                     1.开始游戏\n\n\n\n";
    cout<<"                      2.退出";
    a=0;
    a=getch()-'0';
    return a;
}
void gq()

    for(;;) 
    {
        cout<<"\n\n\n\n\n\n                        关卡\n\n\n"<<endl;
        cout<<"              1.新手教程   2.蹦床世界\n\n"<<endl; 
        cout<<"              3.明枪易躲,暗箭难防(1)\n\n"<<endl;
        cout<<"              4.明枪易躲,暗箭难防(2)\n\n"<<endl;
        cout<<"                      5.退出";
        a=getch()-'0';
        switch(a)
        {
            case 1 :
            {
                system("cls");
                g1();    
                break;    
            }
            case 2 :
            {
                system("cls");
                g2();    
                break;    
            }
            case 3 :
            {
                system("cls");
                g3();
            }
            case 4 :
            {
                system("cls");
                g4();
            }
            case 5 :
            {
                system("cls");
                tc=1;
                break;    
            }
            default:
            {
                system("cls");
                cout<<"\n\n\n\n\n\n\n\n\n\n\n\n             请输入正确的字符!!!";
                system("cls");
                continue;
                
            }
        }
        if(tc==1)
        {
            tc=0;
            break;
        }
    }
    system("cls");
    return ;
}
int main()
{
    sb_ycksbj();
    sb_yc();
    system("title 跑酷游戏");
    system("mode con cols=50 lines=25");
    for(;;)
    {
        hy();
        if(a==1||a==2)
        {
        if(a==1)
        {
            system("cls");
            gq();
        }
        if(a==2)
        {
                system("cls");
                cout<<endl<<endl<<"    再见!    "<<endl<<endl;
                _sleep(750);
                system("cls");
                exit(0);
        }
        }
        else
        {
            system("cls");
            cout<<"\n\n\n\n\n\n\n\n\n\n\n\n             请输入正确的字符!!!";
            system("cls");
            continue;
        }
    }
}

  • 60
    点赞
  • 48
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值