0
点赞
收藏
分享

微信扫一扫

C++细节

 导航:

Dev-c++跑酷小游戏 1.0.0
devc++跑酷小游戏1.2.5
devc++跑酷游戏1.2.6
devc++跑酷游戏2.0.0
devc++跑酷游戏2.0.1
devc++跑酷游戏2.4.0 
devc++跑酷小游戏3.5.0
 devc++小游戏3.8.5

更新内容:

 多更新了两关。退出时取消了那个能关机的彩蛋,增加了存档提醒

重要更新:

移动增加了W、A、D键,W跳,A左移动,D右移动

源代码:

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<cstdio>
using namespace std;
void tiaozhuang6(){return;}
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define Esc 27
int a1,b,b1,gb=0,c,d,tc;
int ax;
int cd=0;
const char rw='@';
//1.新手教程  2.蹦床世界3.小心走错4.暗刺难防5.心跳刺方6.飞得更高
const string gqm[9]={
	"1.新手教程",
	"2.蹦床世界",
	"3.小心走错",
	"4.暗刺难防",
	"5.心跳刺方",
	"6.飞得更高",
	"7.摔得更惨",
	"8.信仰之跃",
	"9.九转大肠"
};
const string fgqm[9]={
	"1. ? ? ? ?",
	"2. ? ? ? ?",
	"3. ? ? ? ?",
	"4. ? ? ? ?",
	"5. ? ? ? ?",
	"6. ? ? ? ?",
	"7. ? ? ? ?",
	"8. ? ? ? ?",
	"9. ? ? ? ?",
};
/*
{
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",	
		"                                                 ",
		"                                                 ",
	},
*/
const string mapp1[9][25]={
	{
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"         =----  --  -- - -----                   ",
		"    -                                            ",
		"---- --                                          ",
		"                               ^                 ",
		"                                                 ",
		"                                                 ",
		"----^--=                                         ",
		"                                   ---=          ",
		"                                                 ",
		"                                              |- ",	
		"                                               $ ",
		"                                             ----",
	},
	{
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                               ==^               ",
		"                                      -  --^     ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                              ==^                ",
		"              --- <                              ",
		"               <                                 ",
		"            ---                                  ", 
		"          --                                 <^ ^",
		"       --                                    <  |",
		"--^ ----               -                      ^ $", 
		"                         ----=                >--",
	},
	{
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"    ==-                                          ",
		"           ^===^    > <    -                     ",
		"           <    > >    <                         ",
		"                  >    <                         ",
		"                       <                         ",
		"                                                 ",
		"           -----                                 ",
		"  ==                                             ",
		"                                                ^",
		"                -=-=-==----                     $",
		"                                              ^--",
		"                                              <  ", 
		"             ===                                 ",
		"                                    >     <      ", 
		"-==                                  ^---^  ==   ", 
	},
	{
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                              ------        ---  ",
		"                             -       ---  --   ^ ",
		"                       <--->                     ",
		"    <->             --                        <^ ",
		"                  --                           <$",
		"  =^    <->                                     <",
		" =            ---^                               ",
		"                                  ^              ",
		"                                  |              ",
		"                                 <|=             ",
		"                                   <             ",
		"                                    >            ",
		" >                                   ---^<^--^-  ",
		"= -- -- - -- --- -- - --- ---                  - ",
		"                              --                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                   ^   ^         ",
		"                             <>   < >  >         ",
		"----^--^-^----^^^---^^-^^^--=  ---   --  ---^---=",
	},
	{
		"                                                 ",
		"|>                                              <",
		"|>                                              <",
		"|>                                              <",
		"|>                      ^        ^              <",//21 0
		"|> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <",
		"|>                                              <",
		"|>   ^^^^^                                      <",
		"|>                               ^              <",
		"|> -  -  -   -       -   -       <-  -   -      <",
		"|>                      ^                       <",
		"|>    ^^^^^^            <          ^^^^^^^      <",
		"|>                                              |",
		"|>   |     |    |            |              |   |",
		"|>   |     |^^^^^^^^^^^^^^^^^^  ^           |   |",
		"|>                                              |",
		"|>         ^^^^^^^^             ^   ^^^^^^^^^^^^<",
		"|>   ^                ^ ^        <->       ^   <<",
		"|>   <>               <>      ^                 <",
		"|> ^     ^             ^      <   ^^^^^^^       |",
		"||^^^^^^^^^^^^^^^^^^^^^>   |^               ^   |",
		"||    ^         ^     <| - |>                   |",
		"||    >               <| $ |>                   |",	
		"||                      =-=    ^                |",
		"||                                              |",
	},
	{
		"                                                 ",
		"                                           -    -",
		"                                                $",
		"                                            ---- ",
		"---                     ---                  |   ",
		"                                             |   ",
		"   =      ^^            =                  =^    ",
		"          <>                                     ",
		"                                           -----=",
		"                 ^^                              ",
		"                 <>                       =      ",
		"                           =                     ",
		"    =                 ^^                         ",
		"                      <>                         ",
		"                     -      ^^                   ",
		"                  ^^        <>           =       ",
		"                  <>   ---=                      ",
		"                                 ^^              ",
		"   =                             <>              ",
		"                                                 ",
		"                 <  --=                          ",
		"                                      ^^         ",
		"                                      <>=        ",	
		"                                                 ",
		"--=                                              ",
	},
	{
		"                                              <|-",
		"                                              <|$",
		"---                                           <| ",
		"                                              <| ",
		"                                              <| ",
		"                                              <| ",
		"                           |                 --- ",
		"      =^                        |                ",
		"      <>                 |             |         ",
		"                                   |       |    =",
		"            -         --                         ",
		"                                                 ",
		"                                               - ",
		"                 ^=                              ",
		"                 <>                              ",
		"                          ==                     ",
		"                          ||                     ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                                 ",
		"                                   |       |     ",	
		"                                              | $",
		"                                        |       -",
		"                                                 ",
	},
	{
		"                                                 ",
		"                                          |-^^- -",
		"  -                                      |----- -",
		"  |>              |                      |  <|   ",
		"- |>          |                         |   <|^  ",
		"  |>                 =        |       -|    <|$  ",
		"  |>                  ^           |         <|-  ",
		"  |>                           ^            <|   ",
		"  |>                                         |   ",
		"  |>                                         |   ",
		" =|>      ^             =                        ",
		"  |>              ^                         ----=",
		"  |>                                             ",
		"  |>                                             ",
		"  |>                                      =      ",
		"  |>          ^                      ^           ",
		"  |>                                             ",
		"= |>                      =^                     ",
		"  |>                                             ",
		"  |>                             ^           =   ",
		"  |>                                             ",
		"  |>                                             ",
		"  |>                                             ",	
		"  |>                                             ",
		"-=|>^^^^^^^^^^^^^^^^^^^^=^^^^^^^^^^^^^^^^=^^^^^^^",
	},
	{
		"-->                                              ",
		" |>                                              ",
		" |>    ----------------------------------------- ",
		" |> = -|                                <|       ",
		" |>    | -------------------------|--   <|       ",
		" |>    |                         <|     <|       ",
		" |>    |                         <|      |^^  ^^^",
		" |>    |                         <| ->   |       ",
		" |>    |                         <|      |       ",
		" |>    |^^^     ^^^^^^^   ^^^^^^ <|      |       ",
		" |>  = |                         <|=--   |- ^^^^^",
		" |>    |                         <|          <$  ",
		" |>    |                         <|---==---- <-  ",
		" |>    |                         <|        | < - ",
		" |>    |                         <|  |     |     ",
		" |>    |                         <|  |     |     ",
		" |>    |^^^^^^^^ ^^^^^^   ^^^^^  <|  |     |     ",
		" |> =  |                         <| =|     |^    ",
		" |>    |                         <|  |^^^ ^|     ",
		"       |                         <|  |     | -^ =",
		"       |                         <|  |     |     ",
		"       |                         <|  |     |     ",
		"       |^^^^^^   > > > > > >     <|  |     |=-^- ",	
		"    -= |                             |           ",
		"^^^^^^^|^^^^^---> < < > < > <> ----=---^^^------=",
	}
};


void tiaozhuang299(){return;}
void sb_ycksbj();
void sb_yd(int x,int y);
void sb_yc();
void g1();
void g2();
void g3();
void g4();
void g5();
void g6();
void g7();
void g8();
void g9();
void gq();
void gq_tc();
void gq_cd();
void gq_dd();
void gq_bz();
void gq_sx(int x,int y,char z,int l,bool pd);
void gq_ys(int x);
void gq_yx(int x,int y,char z,int l);
int gq_zt(bool pd);
int hy();
bool sb_pd(long x,long y,long w,long hi);


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_yc()
{
	HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_CURSOR_INFO CursorInfo;
	GetConsoleCursorInfo(handle,&CursorInfo);//获取控制台光标信息
	CursorInfo.bVisible=false; //隐藏控制台光标
	SetConsoleCursorInfo(handle,&CursorInfo);//设置控制台光标状态
}
void gq_ys(int x)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x);    //x代表的是第几号颜色 前面的GetStdHandle(STD_OUTPUT_HANDLE)是获取当前窗口权柄,简单来说就是让这个颜色加在这个页面
	return;
}
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);
}
bool sb_pd(long x,long y,long w,long hi)
{
	POINT p;
	HWND h=GetForegroundWindow();
	GetCursorPos(&p);
	ScreenToClient(h,&p);
	p.x/=8;
	p.y/=16;
	return p.x>=x-1&&p.x<=x+w&&p.y>=y-1&&p.y<=y+hi;
}
bool sb_anx()
{
	return KEY_DOWN(VK_LBUTTON);
}
bool sb_anniu(long x,long y,long w,long hi,const string world,int oldcolor,int newcolor)
{
	bool pd=false;
	if(sb_pd(x,y,w,hi))
	{
		sb_yd(x,y);
		gq_ys(newcolor);
		cout<<world;
		gq_ys(oldcolor);
		if(sb_anx()&&sb_pd(x,y,w,hi))
		{
			pd=true;
		}
	}
	else
	{
		sb_yd(x,y);
		gq_ys(oldcolor);
		cout<<world;
	}
	return pd;
}
void gq_bz()
{
	sb_yd(0,0);
	
	return ;
}
void gq_dd()
{
	sb_yd(0,0);
	FILE* dqwj=fopen("gq_cd.game","rb");
	if(dqwj!=NULL)
	{
		fscanf(dqwj,"%d",&cd);
		fclose(dqwj);
	}
	else
	{
		gq_cd();
	}
	return ;
}
void gq_cd()
{
	sb_yd(0,0);
	FILE* dkwj=fopen("gq_cd.game","wb");
	fprintf(dkwj,"%d",cd);
	fclose(dkwj);
	gb=0;
	return ;
}
void gq_tc()
{
	sb_yd(0,0);
	if(gb==0) 
	{
		system("cls");
		system("mode con cols=15 lines=5");
		cout<<endl<<endl<<"    再见!    "<<endl<<endl;
		_sleep(750);
		system("cls");
		exit(0);
	}
	else
	{
		system("cls");
		for(;;)
		{
			sb_yd(0,0);
			system("mode con cols=23 lines=3");
			cout<<"您还没存档,是否退出?"<<endl;
			char a=0;
			if(a=='1'||sb_anniu(0,1,6,0,"1.存档",112,127))
			{
				gq_cd();
				system("cls");
				system("mode con cols=15 lines=5");
				cout<<endl<<endl<<"    再见!    "<<endl<<endl;
				_sleep(750);
				system("cls");
				exit(0);
			}
			else if(a=='2'||sb_anniu(11,1,10,0,"2.直接退出",112,127))
			{
				system("cls");
				system("mode con cols=15 lines=5");
				cout<<endl<<endl<<"    再见!    "<<endl<<endl;
				_sleep(750);
				system("cls");
				exit(0);
			}
		}
	}
}
void gq_sx(int x,int y,char z,int l,bool pd)
{
	if(pd)//判断pd是否为真,可以写成if(pd==ture) 
	{
		system("cls");
		cout<<"刷新中...";
		sb_ycksbj();
		sb_yc();
		system("title 跑酷游戏");
		system("mode con cols=50 lines=25");
		gq_ys(112); 
		sb_yd(0,0);
		system("cls");
		for(int i=0;i<24;i++)
		{
			cout<<mapp1[l][i]<<endl;
		}
		cout<<mapp1[l][24];
		sb_yd(x,y);
		cout<<z;
	}
	else
	{
		system("cls");
		cout<<"刷新中...";
		sb_ycksbj();
		sb_yc();
		system("title 跑酷游戏");
		system("mode con cols=50 lines=25");
		gq_ys(112); 
		system("cls");
	}
	return;
} 
int gq_zt(bool pd)
{
	_sleep(50);
	system("cls");
	if(pd)
	{
		for(;;)
		{	
			sb_yd(0,0);
			cout<<"\n\n\n\n\n";
			cout<<"                       暂停中";
			char x=0;
			if(kbhit()!=0)
			{
				x=getch();
			}
			if(x==Esc||sb_anniu(22,8,8,0,"Esc.返回",112,127))
			{
				system("cls");
				_sleep(50);
				return 0;
			}
			else if(x=='1'||sb_anniu(23,11,6,0,"1.退出",112,127))
			{
				system("cls");
				_sleep(50);
				return 1;
			}
			else if(x=='2'||sb_anniu(23,14,6,0,"2.刷新",112,127))
			{
				system("cls");
				_sleep(50);
				return 2;
			}
			else if(x=='3'||sb_anniu(23,17,6,0,"3.存档",112,127))
			{
				system("cls");
				_sleep(50);
				return 3;
			}
			else if(x=='4'||sb_anniu(21,20,10,0,"4.退出游戏",112,127))
			{
				system("cls");
				gq_tc();
			}
		}
	}	
	else
	{
		for(;;)
		{
			sb_yd(0,0);
			cout<<"\n\n\n\n\n";
			cout<<"                       暂停中";
			char x=0;
			if(kbhit()!=0)
			{
				x=getch();
			}
			if(x=='1'||sb_anniu(23,10,6,0,"1.退出",112,127))
			{
				system("cls");
				_sleep(50);
				return 1;
			}
			else if(x=='2'||sb_anniu(23,14,6,0,"2.存档",112,127))
			{
				system("cls");
				_sleep(50);
				return 2;
			}
			else if(x==Esc||sb_anniu(20,18,12,0,"Esc.退出游戏",112,127))
			{
				system("cls");
				gq_tc();
			}
		}	
	}
	return 0;
} 
void gq_yx(int x,int y,char z,int l)
{
	_sleep(50);
	int x1=x,yy1=y,ax=0;
	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]=='$')
						{
							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]=='$')
									{
										x1--;
										sb_yd(x1,yy1);
										cout<<z<<" ";
									}
								}
								if(ax==77)
								{
									if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
									{
										sb_yd(x1,yy1);
										cout<<" "<<z;
										x1++;
									}
								}
							}
							if(ax=='a'||ax=='A')
							{
								if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
								{
									x1--;
									sb_yd(x1,yy1);
									cout<<z<<" ";
								}
							}
							else if(ax=='d'||ax=='D')
							{
								if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
								{
									sb_yd(x1,yy1);
									cout<<" "<<z;
									x1++;
								}
							}
							if(ax=='Z'||ax=='z')
							{
								system("cls");
								gq_sx(x1,yy1,z,l,1);
							}
							if(ax=='X'||ax=='x')
							{
								system("cls");
								switch(gq_zt(1))
								{
									case 0 :
									{
										ax=0;
										gq_sx(x1,yy1,z,l,1);
										break;
									}
									case 1 :
									{
										ax=0;
										return;
									}
									case 2 :
									{
										ax=0;
										gq_sx(x1,yy1,z,l,1);
										break;
									}
									case 3 :
									{
										ax=0;
										gq_cd();
										gq_sx(x1,yy1,z,l,1);
										break;
									}
									default:
									{
										ax=0;
										break;
									}
								}
							}
						}
					}
				}
				else if(ax==75)
				{
					if(x1>=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
					{
						x1--;
						sb_yd(x1,yy1);
						cout<<z<<" ";
					}
				}
				if(ax==77)
				{
					if(x1<=48&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
					{
						sb_yd(x1,yy1);
						cout<<" "<<z;
						x1++;
					}
				}
			}
			if(ax=='a'||ax=='A')
			{
				if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
				{
					x1--;
					sb_yd(x1,yy1);
					cout<<z<<" ";
				}
			}
			else if(ax=='d'||ax=='D')
			{
				if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
				{
					sb_yd(x1,yy1);
					cout<<" "<<z;
					x1++;
				}
			}
			else if(ax=='w'||ax=='W')
			{
				for(int j=1;j<=4;j++)
				{
					_sleep(100);
					if(yy1!=0&&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]=='$')
								{
									x1--;
									sb_yd(x1,yy1);
									cout<<z<<" ";
								}
							}
							if(ax==77)
							{
								if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
								{
									sb_yd(x1,yy1);
									cout<<" "<<z;
									x1++;
								}
							}
						}
						if(ax=='a'||ax=='A')
						{
							if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
							{
								x1--;
								sb_yd(x1,yy1);
								cout<<z<<" ";
							}
						}
						else if(ax=='d'||ax=='D')
						{
							if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
							{
								sb_yd(x1,yy1);
								cout<<" "<<z;
								x1++;
							}
						}
						if(ax=='Z'||ax=='z')
						{
							system("cls");
							gq_sx(x1,yy1,z,l,1);
						}
						if(ax=='X'||ax=='x')
						{
							system("cls");
							switch(gq_zt(1))
							{
								case 0 :
								{
									ax=0;
									gq_sx(x1,yy1,z,l,1);
									break;
								}
								case 1 :
								{
									ax=0;
									return;
								}
								case 2 :
								{
									ax=0;
									gq_sx(x1,yy1,z,l,1);
									break;
								}
								case 3 :
								{
									ax=0;
									gq_cd();
									gq_sx(x1,yy1,z,l,1);
									break;
								}
								default:
								{
									ax=0;
									break;
								}
							}
						}	
					}
				}
			}
			if(ax=='Z'||ax=='z')
			{
				system("cls");
				gq_sx(x1,yy1,z,l,1);
			}
			if(ax=='X'||ax=='x')
			{
				system("cls");
				switch(gq_zt(1))
				{
					case 0 :
					{
						ax=0;
						gq_sx(x1,yy1,z,l,1);
						break;
					}
					case 1 :
					{
						ax=0;
						return;
					}
					case 2 :
					{
						ax=0;
						gq_sx(x1,yy1,z,l,1);
						break;
					}
					case 3 :
					{
						ax=0;
						gq_cd();
						gq_sx(x1,yy1,z,l,1);
						break;
					}
					default:
					{
						ax=0;
						break;
					}
				}
			}
			ax=0;
		}
 		while(mapp1[l][yy1+1][x1]==' '||mapp1[l][yy1+1][x1]=='$'&&yy1<=24)
		{
			_sleep(100);
	 		sb_yd(x1,yy1);
			cout<<" ";
			yy1+=1;
			if(yy1<=24)
			{
				sb_yd(x1,yy1);
	 			cout<<z;	
			}
	 		if(kbhit()!=0)
			{
				ax=getch();
				if(ax==224)
				{
					ax=getch();
					if(ax==75)
					{
						if(x1>=0&&yy1<=24&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
						{
							x1--;
							sb_yd(x1,yy1);
							cout<<z<<" ";
						}
					}
					if(ax==77)
					{
						if(x1<=48&&yy1<=24&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
						{
							sb_yd(x1,yy1);
							cout<<" "<<z;
							x1++;
						}
					}
				}
				if(ax=='a'||ax=='A')
				{
					if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
					{
						x1--;
						sb_yd(x1,yy1);
						cout<<z<<" ";
					}
				}
				else if(ax=='d'||ax=='D')
				{
					if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
					{
						sb_yd(x1,yy1);
						cout<<" "<<z;
						x1++;
					}
				}
				if(ax=='Z'||ax=='Z')
				{
					system("cls");
					gq_sx(x1,yy1,z,l,1);
				}
				if(ax=='X'||ax=='x')
				{
					system("cls");
					switch(gq_zt(1))
					{
						case 0 :
						{
							ax=0;
							gq_sx(x1,yy1,z,l,1);
							break;
						}
						case 1 :
						{
							ax=0;
							return;
						}
						case 2 :
						{
							ax=0;
							gq_sx(x1,yy1,z,l,1);
							break;
						}
						case 3 :
						{
							ax=0;
							gq_cd();
							gq_sx(x1,yy1,z,l,1);
							break;
						}
						default:
						{
							ax=0;
							break;
						}
					}
				}
				ax=0;	
			}
			if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>'||mapp1[l][yy1-1][x1]=='v'||yy1==25)
			{
				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&&yy1>1;j++)
			{
				_sleep(50);
				if(mapp1[l][yy1-1][x1]==' ')
				{
					sb_yd(x1,yy1);
					cout<<" ";
					yy1--;
					sb_yd(x1,yy1);
					cout<<z;	
					if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>'||mapp1[l][yy1-1][x1]=='v'||yy1==25)
					{
						sb_yd(x1,yy1);
						cout<<" ";
						x1=x;
						yy1=y;
						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]=='$')
							{
								x1--;
								sb_yd(x1,yy1);
								cout<<z<<" ";
							}
						}
						if(ax==77)
						{
							if(x1<=48&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
							{
								sb_yd(x1,yy1);
								cout<<" "<<z;
								x1++;
							}
						}
					}
					if(ax=='a'||ax=='A')
					{
						if(x1!=0&&mapp1[l][yy1][x1-1]==' '||mapp1[l][yy1][x1-1]=='$')
						{
							x1--;
							sb_yd(x1,yy1);
							cout<<z<<" ";
						}
					}
					else if(ax=='d'||ax=='D')
					{
						if(x1!=49&&mapp1[l][yy1][x1+1]==' '||mapp1[l][yy1][x1+1]=='$')
						{
							sb_yd(x1,yy1);
							cout<<" "<<z;
							x1++;
						}
					}
					if(ax=='Z'||ax=='z')
					{
						system("cls");
						gq_sx(x1,yy1,z,l,1);
					}
					if(ax=='X'||ax=='x')
					{
						system("cls");
						switch(gq_zt(1))
						{
							case 0 :
							{
								ax=0;
								gq_sx(x1,yy1,z,l,1);
								break;
							}
							case 1 :
							{
								ax=0;
								return;
							}
							case 2 :
							{
								ax=0;
								gq_sx(x1,yy1,z,l,1);
								break;
							}
							case 3 :
							{
								ax=0;
								gq_cd();
								gq_sx(x1,yy1,z,l,1);
								break;
							}
							default:
							{
								ax=0;
								break;
							}
						}
					}
					ax=0;	
				} 
			}
		}	
		if(mapp1[l][yy1+1][x1]=='^'||mapp1[l][yy1][x1+1]=='<'||mapp1[l][yy1][x1-1]=='>'||mapp1[l][yy1-1][x1]=='v'||yy1==25)
		{
			sb_yd(x1,yy1);
			cout<<" ";
			x1=x;
			yy1=y;
			sb_yd(x1,yy1);
			cout<<z;
		}
		if(ax=='X'||ax=='x')
		{
			switch(gq_zt(1))
			{
				case 0 :
				{
					ax=0;
					gq_sx(x1,yy1,z,l,1);
					break;
				}
				case 1 :
				{
					ax=0;
					return;
				}
				case 2 :
				{
					ax=0;
					gq_sx(x1,yy1,z,l,1);
					break;
				}
				case 3 :
				{
					ax=0;
					gq_cd();
					gq_sx(x1,yy1,z,l,1);
					break;
				}
				default:
				{
					ax=0;
					break;
				}
			}
		}
		if(ax=='Z'||ax=='Z')
		{
			system("cls");
			gq_sx(x1,yy1,z,l,1);
		}
		ax=0;
		if(mapp1[l][yy1][x1]=='$')	
		{
			if(cd<=l+1)
			{
				cd=l+1;
				gb=1;
			} 
			_sleep(10);
			system("cls");
			sb_yd(0,0);
			cout<<"你赢了!"<<endl;
			system("pause");
			system("cls");
			sb_yd(0,0);
			return ;
		}
	}
	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,18,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,22,rw,1);
	return;
}
void g3()
{
	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[2][i]<<endl;
	}
	cout<<mapp1[2][24];
	gq_yx(0,23,rw,2);
	return;
}
void g4()
{
	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[3][i]<<endl;
	}
	cout<<mapp1[3][24];
	gq_yx(0,23,rw,3);
	return;
}
void g5()
{
	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[4][i]<<endl;
	}
	cout<<mapp1[4][24];
	gq_yx(23,2,rw,4);
	return;
}
void g6()
{
	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[5][i]<<endl;
	}
	cout<<mapp1[5][24];
	gq_yx(0,23,rw,5);
	return;
}
void g7()
{
	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[6][i]<<endl;
	}
	cout<<mapp1[6][24];
	gq_yx(0,1,rw,6);
	return;
}
void g8()
{
	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[7][i]<<endl;
	}
	cout<<mapp1[7][24];
	gq_yx(0,23,rw,7);
	return;
}
void g9()
{
	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[8][i]<<endl;
	}
	cout<<mapp1[8][24];
	gq_yx(0,1,rw,8);
	return;
}
int hy()
{
	if(c==0)
	{
		cout<<"\n\n\n\n\n\n\n\n\n\n\n\n           ============欢迎============           "<<endl;
		c++;
		_sleep(1000);
		system("cls");
	}
	char x=0;
	for(;;)
	{
		sb_yd(0,0);
		cout<<"\n\n\n\n\n\n                       首页";
		x=0;
		if(kbhit()!=0)
		{
			x=getch();
		}
		if(sb_anniu(20,11,10,0,"1.开始游戏",112,127))
		{
			x='1';
		}
		else if(sb_anniu(22,15,6,0,"2.存档",112,127))
		{
			x='2';
		}
		else if(sb_anniu(19,19,8,0,"Esc.退出游戏",112,127))
		{
			x='3';
		}
		if(x!=0)
		{
			break;
		}
	}
	system("cls");
	_sleep(50);
	return x;
}
void gq()
{
	_sleep(50);
	gq_dd();
	for(;;) 
	{
		sb_yd(0,0);
		char x=0;
		cout<<"\n\n\n\n\n                         关卡";
		if(kbhit()!=0)
		{
			x=getch();
		}
		if(x=='1'||((cd>=0)?sb_anniu(14,9,10,0,gqm[0],112,127):sb_anniu(14,9,10,0,fgqm[0],112,127)))
		{
			system("cls");
			if(cd>=0)
			{
				g1();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='2'||((cd>=1)?sb_anniu(27,9,10,0,gqm[1],112,127):sb_anniu(27,9,10,0,fgqm[1],112,127)))
		{
			system("cls");
			if(cd>=1)
			{
				g2();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='3'||((cd>=2)?sb_anniu(14,12,10,0,gqm[2],112,127):sb_anniu(14,12,10,0,fgqm[2],112,127)))
		{
			system("cls");
			if(cd>=2)
			{
				g3();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='4'||((cd>=3)?sb_anniu(27,12,10,0,gqm[3],112,127):sb_anniu(27,12,10,0,fgqm[3],112,127)))
		{
			system("cls");
			if(cd>=3)
			{
				g4();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='5'||((cd>=4)?sb_anniu(14,15,10,0,gqm[4],112,127):sb_anniu(14,15,10,0,fgqm[4],112,127)))
		{
			system("cls");
			if(cd>=4)
			{
				g5();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='6'||((cd>=5)?sb_anniu(27,15,10,0,gqm[5],112,127):sb_anniu(27,15,10,0,fgqm[5],112,127)))
		{
			system("cls");
			if(cd>=5)
			{
				g6();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='7'||((cd>=6)?sb_anniu(14,18,10,0,gqm[6],112,127):sb_anniu(14,18,10,0,fgqm[6],112,127)))
		{
			system("cls");
			if(cd>=6)
			{
				g7();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='8'||((cd>=7)?sb_anniu(27,18,10,0,gqm[7],112,127):sb_anniu(27,18,10,0,fgqm[7],112,127)))
		{
			system("cls");
			if(cd>=7)
			{
				g8();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x=='9'||((cd>=8)?sb_anniu(14,21,10,0,gqm[8],112,127):sb_anniu(14,21,10,0,fgqm[8],112,127)))
		{
			system("cls");
			if(cd>=8)
			{
				g9();	
			} 	
			else
			{
				cout<<"\n\n\n\n\n\n\n\n\n\n\n       您还没有解锁此关,请通关前一关后解锁!";
				_sleep(500);
				system("cls");
			}
		}
		else if(x==Esc||sb_anniu(29,21,8,0,"Esc.退出",112,127))
		{
			tc=1;
		}
		else if(x=='z')
		{
			gq_sx(0,0,0,0,0);
		}
		else if(x=='x')
		{
			gq_zt(0);
		}
		
		if(tc==1)
		{
			tc=0;
			system("cls");
			break;
		}
		x=0;
	}
	system("cls");
	return ;
}
int main()
{
	cout<<"加载中...";
	sb_ycksbj();
	sb_yc();
	system("title 跑酷游戏");
	system("mode con cols=50 lines=25");
	gq_ys(112); 
	gq_dd();
	system("cls");
	for(;;)
	{
		switch(hy())  
		{
			case '1' :
			{
				system("cls");
				gq();	
				break;
			}
			case '2' :
			{
				gq_cd();
				break;
			}
			case 'z' :
			case 'Z' :
			{
				gq_sx(0,0,0,0,0);
				break;
			}
			case 'x' :
			case 'X' :
			{
				switch(gq_zt(0))
				{
					case 1 :
					{
						break;
					}
					case 2 :
					{
						gq_cd();
					}
				}
				break;
			}
			case Esc :
			{
				system("cls");
				gq_tc();
			}
			default:
			{
				system("cls"); 
				break;
			}
		}
	}
}
举报

相关推荐

0 条评论