导航:
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
devc++跑酷小游戏4.0.0
更新内容:
也没更新多少,改了界面颜色和按钮,关卡微微微微微调。
把一些函数和地图放到了一个叫gqhs的结构体里面,顾名思义,关卡函数
代码:
#include<bits/stdc++.h>
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<cstdio>
#include<fstream>
using namespace std;
void tiaozhuang8(){;}
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
#define Esc 27
#define NC 14
#define BC 240
#define SX 'z'
#define Sx 'Z'
#define ZT 'x'
#define Zt 'X'
bool hydh=false,csh=false;
void g1();
void g2();
void g3();
void g4();
void g5();
void g6();
void g7();
void g8();
void g9();
void gq();
void tc();
void bz();
void yx(int x,int y,char z,int l);
void hy();
//
//
struct gqhs
{
int cd=0,x=0,y=0;
bool gb=true;
const string gqm[9]=
{
"1.新手教程",
"2.蹦床世界",
"3.小心走错",
"4.暗刺难防",
"5.心跳刺方",
"6.飞得更高",
"7.摔得更惨",
"8.信仰之跃",
"9.九转大肠"
};
const char rw='@';
const string fgqm[9]=
{
"1. ? ? ? ?",
"2. ? ? ? ?",
"3. ? ? ? ?",
"4. ? ? ? ?",
"5. ? ? ? ?",
"6. ? ? ? ?",
"7. ? ? ? ?",
"8. ? ? ? ?",
"9. ? ? ? ?",
};
const string mapp[9][25]={
{
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" =---- -- -- - ----- ",
" - ",
"---- -- ",
" ^ ",
" ",
" ",
"----^--= ",
" ---= ",
" ",
" |- ",
" $ ",
" ----",
},
{
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ==^ ",
" - --^ ",
" ",
" ",
" ",
" ",
" ",
" ==^ ",
" --- < ",
" < ",
" --- ",
" -- <^ ^",
" -- < |",
"--^ ---- - ^ $",
" ----= >--",
},
{
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ==- ",
" ^===^ > < - ",
" < > > < ",
" > < ",
" < ",
" ",
" ----- ",
" == ",
" ^",
" -=-=-==---- $",
" ^--",
" < ",
" === ",
" > < ",
"-== ^---^ == ",
},
{
" ",
" ",
" ",
" ",
" ------ --- ",
" - --- -- ^ ",
" <---> ",
" <-> -- <^ ",
" -- <$",
" =^ <-> <",
" = ---^ ",
" ^ ",
" | ",
" <|= ",
" < ",
" > ",
" > ---^<^--^- ",
"= -- -- - -- --- -- - --- --- - ",
" -- ",
" ",
" ",
" ",
" ^ ^ ",
" <> < > > ",
"----^--^-^----^^^---^^-^^^--= --- -- ---^---=",
},
{
" ",
"|> <",
"|> <",
"|> <",
"|> ^ ^ <",//21 0
"|> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <",
"|> <",
"|> ^^^^^ <",
"|> ^ <",
"|> - - - - - - <- - - <",
"|> ^ <",
"|> ^^^^^^ < ^^^^^^^ <",
"|> |",
"|> | | | | | |",
"|> | |^^^^^^^^^^^^^^^^^^ ^ | |",
"|> |",
"|> ^^^^^^^^ ^ ^^^^^^^^^^^^<",
"|> ^ ^ ^ <-> ^ <<",
"|> <> <> ^ <",
"|> ^ ^ ^ < ^^^^^^^ |",
"||^^^^^^^^^^^^^^^^^^^^^> |^ ^ |",
"|| ^ ^ <| - |> |",
"|| > <| $ |> |",
"|| =-= ^ |",
"|| |",
},
{
" ",
" - -",
" $",
" ---- ",
"--- --- | ",
" | ",
" = ^^ = =^ ",
" <> ",
" -----=",
" ^^ ",
" <> = ",
" = ",
" = ^^ ",
" <> ",
" - ^^ ",
" ^^ <> = ",
" <> ---= ",
" ^^ ",
" = <> ",
" ",
" < --= ",
" ^^ ",
" <>= ",
" ",
"--= ",
},
{
" <|-",
" <|$",
"--- <| ",
" <| ",
" <| ",
" <| ",
" | --- ",
" =^ | ",
" <> | | ",
" | | =",
" - -- ",
" ",
" - ",
" ^= ",
" <> ",
" == ",
" || ",
" ",
" ",
" ",
" ",
" | | ",
" | $",
" | -",
" ",
},
{
" ",
" |-^^- -",
" - |----- -",
" |> | | <| ",
"- |> | | <|^ ",
" |> = | -| <|$ ",
" |> ^ | <|- ",
" |> ^ <| ",
" |> | ",
" |> | ",
" =|> ^ = ",
" |> ^ ----=",
" |> ",
" |> ",
" |> = ",
" |> ^ ^ ",
" |> ",
"= |> =^ ",
" |> ",
" |> ^ = ",
" |> ",
" |> ",
" |> ",
" |> ",
"-=|>^^^^^^^^^^^^^^^^^^^^=^^^^^^^^^^^^^^^^=^^^^^^^",
},
{
"--> ",
" |> ",
" |> ----------------------------------------- ",
" |> = -| <| ",
" |> | -------------------------|-- <| ",
" |> | <| <| ",
" |> | <| |^^ ^^^",
" |> | <| -> | ",
" |> | <| | ",
" |> |^^^ ^^^^^^^ ^^^^^^ <| | ",
" |> = | <|=-- |- ^^^^^",
" |> | <| <$ ",
" |> | <|---==---- <- ",
" |> | <| | < - ",
" |> | <| | | ",
" |> | <| | | ",
" |> |^^^^^^^^ ^^^^^^ ^^^^^ <| | | ",
" |> = | <| =| |^ ",
" |> | <| |^^^ ^| ",
" | <| | | -^ =",
" | <| | | ",
" | <| | | ",
" |^^^^^^ > > > > > > <| | |=-^- ",
" -= | | ",
"^^^^^^^|^^^^^---> < < > < > <> ----=---^^^------=",
}
};
const char* name="gqcd_playgame_save.bin";
void gcd();
void gdd();
void ycksbj();
void ycgb();
void ys(int n);
void ydgb(int x,int y);
bool pdgbwz(long x,long y,long w,long hi);
bool pdsbzt();
bool anniu(long x,long y,long w,long hi,const string world,int oldcolor,int newcolor);
};
gqhs g;
void gqhs::gcd()
{
ofstream out(name,ios::out|ios::trunc);
out<<cd;
out.close();
gb=true;
return;
}
void gqhs::gdd()
{
ifstream in(name,ios::in);
in.seekg(0,ios::beg);
while(in>>cd);
in.close();
return;
}
void gqhs::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);
return;
}
void gqhs::ycgb()
{
HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle,&CursorInfo);//获取控制台光标信息
CursorInfo.bVisible=false; //隐藏控制台光标
SetConsoleCursorInfo(handle,&CursorInfo);//设置控制台光标状态
return;
}
void gqhs::ys(int n)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),n); //n代表的是第几号颜色 前面的GetStdHandle(STD_OUTPUT_HANDLE)是获取当前窗口权柄,简单来说就是让这个颜色加在这个页面
return;
}
void gqhs::ydgb(int x,int y) //光标移动到x,y
{
HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X=x;
pos.Y=y;
SetConsoleCursorPosition(handle,pos);
return;
}
bool gqhs::pdgbwz(long x,long y,long w,long hi)
{
HANDLE hOutput=GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
POINT p;
GetCursorPos(&p);
ScreenToClient(h,&p);
GetCurrentConsoleFont(hOutput,FALSE,&consoleCurrentFont);
p.x/=consoleCurrentFont.dwFontSize.X;
p.y/=consoleCurrentFont.dwFontSize.Y;
return p.x>=x&&p.x<=x+w&&p.y>=y&&p.y<=y+hi;
}
bool gqhs::pdsbzt()
{
return KEY_DOWN(VK_LBUTTON);
}
bool gqhs::anniu(long x,long y,long w,long hi,const string world,int oldcolor,int newcolor)
{
bool pd=false;
if(pdgbwz(x,y,w,hi))
{
ydgb(x,y);
ys(newcolor);
cout<<world;
ys(oldcolor);
if(pdsbzt()&&pdgbwz(x,y,w,hi))
{
pd=true;
}
}
else
{
ydgb(x,y);
ys(oldcolor);
cout<<world;
}
return pd;
}
//
void tc()
{
g.ydgb(0,0);
if(g.gb)
{
system("cls");
system("mode con cols=15 lines=5");
cout<<endl<<endl<<" 再见! "<<endl<<endl;
Sleep(750);
system("cls");
exit(0);
}
else
{
system("cls");
for(;;)
{
g.ydgb(0,0);
system("mode con cols=23 lines=3");
cout<<"您还没存档,是否退出?"<<endl;
char a=0;
if(a=='1'||g.anniu(0,1,6,0,"1.存档",BC,NC))
{
g.gcd();
system("cls");
system("mode con cols=15 lines=5");
cout<<endl<<endl<<" 再见! "<<endl<<endl;
Sleep(750);
system("cls");
exit(0);
}
else if(a=='2'||g.anniu(11,1,10,0,"2.直接退出",BC,NC))
{
system("cls");
system("mode con cols=15 lines=5");
cout<<endl<<endl<<" 再见! "<<endl<<endl;
Sleep(750);
system("cls");
exit(0);
}
}
}
}
void sx(int x,int y,char z,int l,bool pd)
{
if(pd)//判断pd是否为真,可以写成if(pd==ture)
{
system("cls");
cout<<"刷新中...";
g.ycksbj();
g.ycgb();
system("title 跑酷游戏");
system("mode con cols=50 lines=25");
g.ys(BC);
g.ydgb(0,0);
system("cls");
for(int i=0;i<24;i++)
{
cout<<g.mapp[l][i]<<endl;
}
cout<<g.mapp[l][24];
g.ydgb(x,y);
cout<<z;
}
else
{
system("cls");
cout<<"刷新中...";
g.ycksbj();
g.ycgb();
system("title 跑酷游戏");
system("mode con cols=50 lines=25");
g.ys(BC);
system("cls");
}
return;
}
int zt(int x,int y,int z,int l,bool chose)
{
Sleep(50);
system("cls");
if(chose)
{
for(;;)
{
g.ydgb(0,0);
cout<<"\n\n\n\n\n";
cout<<" 暂停中";
char x=0;
if(kbhit()!=0)
{
x=getch();
}
if(x==Esc||g.anniu(22,8,8,0,"Esc.返回",BC,NC))
{
system("cls");
sx(x,y,z,l,chose);
return 0;
}
else if(x=='1'||g.anniu(23,11,6,0,"1.退出",BC,NC))
{
system("cls");
Sleep(50);
return 1;
}
else if(x=='2'||g.anniu(23,14,6,0,"2.刷新",BC,NC))
{
system("cls");
sx(x,y,z,l,chose);
return 0;
}
else if(x=='3'||g.anniu(23,17,6,0,"3.存档",BC,NC))
{
system("cls");
g.gcd();
sx(x,y,z,l,chose);
return 0;
}
else if(x=='4'||g.anniu(21,20,10,0,"4.退出游戏",BC,NC))
{
system("cls");
tc();
}
}
}
else
{
for(;;)
{
g.ydgb(0,0);
cout<<"\n\n\n\n\n";
cout<<" 帮助";
char x=0;
if(kbhit()!=0)
{
x=getch();
}
if(x=='1'||g.anniu(23,10,6,0,"1.返回",BC,NC))
{
system("cls");
Sleep(50);
return 0;
}
else if(x=='2'||g.anniu(23,14,6,0,"2.存档",BC,NC))
{
system("cls");
g.gcd();
Sleep(40);
return 0;
}
else if(x==Esc|g.anniu(20,18,12,0,"3.Esc退出游戏",BC,NC))
{
system("cls");
tc();
}
}
}
return 0;
}
void bz()
{
system("cls");
Sleep(50);
for(;;)
{
g.ydgb(0,0);
cout<<"\n\n\n\n\n";
cout<<" 帮助文档";
char x=0;
if(kbhit()!=0)
{
x=getch();
}
if(x=='1'||g.anniu(20,10,10,0,"1.字符说明",BC,NC))
{
system("cls");
Sleep(50);
for(;;)
{
g.ydgb(0,0);
cout<<"字符说明:"<<endl<<endl<<endl;
cout<<"--------------------------------------------------"<<endl;
cout<<"'@'代表你"<<endl<<endl;
cout<<"'-'代表路,你可以在上面行走"<<endl<<endl;
cout<<"'='代表蹦床,你在上面会被弹的很高,也可以在上面行走"<<endl<<endl;
cout<<"'^'、'<'、'>'代表刺,一个刺上面一格,一个刺左边一格,一个刺右边一格,刺中了要重新开始,刺左边和右边的刺你可以站在它的正上方而不会被刺中重新开始"<<endl<<endl;
cout<<"'$'代表终点"<<endl<<endl;
cout<<"'|'代表墙,你可以站在上面,但是在同一行无法穿过去"<<endl;
cout<<"--------------------------------------------------";
if(kbhit()!=0)
{
x=getch();
}
if(x==Esc||g.anniu(0,21,8,0,"Esc.返回",BC,NC))
{
system("cls");
break;
}
}
}
else if(x=='2'||g.anniu(20,13,10,0,"2.按键说明",BC,NC))
{
system("cls");
Sleep(50);
for(;;)
{
g.ydgb(0,0);
cout<<"按键说明:"<<endl<<endl<<endl;
cout<<"--------------------------------------------------"<<endl;
cout<<"普通按键:"<<endl<<endl;
cout<<"上箭头和'w'键代表跳,最多跳4格"<<endl;
cout<<"左箭头和's'代表向左走一格"<<endl;
cout<<"右箭头和'd'代表向右走一格"<<endl;
cout<<"功能按键:"<<endl<<endl;
cout<<"'z'键代表刷新,大小写都行"<<endl;
cout<<"'x'键代表暂停,大小写都行"<<endl;
cout<<"--------------------------------------------------";
if(kbhit()!=0)
{
x=getch();
}
if(x==Esc||g.anniu(0,16,8,0,"Esc.返回",BC,NC))
{
system("cls");
break;
}
}
}
else if(x=='3'||g.anniu(20,16,10,0,"3.温馨提示",BC,NC))
{
system("cls");
Sleep(50);
for(;;)
{
g.ydgb(0,0);
cout<<"温馨提示:"<<endl<<endl;
cout<<"--------------------------------------------------"<<endl;
cout<<"不要调整游戏窗口大小!!!不要调整游戏窗口大小!!!不要调整游戏窗口大小!!!会出bug!!!会出bug!!!会出bug!!!(重要的事情说三遍)"<<endl<<endl;
cout<<"如果有bug可以刷新(不知道如何刷新的看<<按键说明>>)"<<endl<<endl;
cout<<"如果用上箭头加左或右箭头进行移动一次性会移动两格,用'w'加上'a'或's'则不会(c++和windows的奇妙特性+1,绝对不是bug)"<<endl<<endl;
cout<<"地图和关卡名可以自己进行改编(很\"刑\")"<<endl<<endl;
cout<<"游戏初始化(加载)时可能会卡,千万不要拖动窗口,会错位(特性+2,错位了也可以用刷新解决)"<<endl<<endl;
cout<<"--------------------------------------------------";
if(kbhit()!=0)
{
x=getch();
}
if(x==Esc||g.anniu(0,20,8,0,"Esc.返回",BC,NC))
{
system("cls");
break;
}
}
}
else if(x==Esc||g.anniu(21,19,8,0,"Esc.返回",BC,NC))
{
system("cls");
break;
}
}
Sleep(50);
return ;
}
void yx(int x,int y,char z,int l)
{
Sleep(50);
int ax=0;
g.x=x;
g.y=y;
g.ydgb(g.x,g.y);
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(g.y!=0&&g.mapp[l][g.y-1][g.x]==' '||g.mapp[l][g.y-1][g.x]=='$')
{
g.ydgb(g.x,g.y);
cout<<" ";
g.y--;
g.ydgb(g.x,g.y);
cout<<z;
}
if(kbhit()!=0)
{
ax=getch();
if(ax==224)
{
ax=getch();
if(ax==75)
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
if(ax==77)
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
}
if(ax=='a'||ax=='A')
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
else if(ax=='d'||ax=='D')
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
if(ax==Sx||ax==SX)
{
system("cls");
sx(g.x,g.y,z,l,1);
}
if(ax==Zt||ax==ZT)
{
system("cls");
if(zt(g.x,g.y,z,l,true)==1)
{
return;
}
ax=0;
}
}
}
}
else if(ax==75)
{
if(g.x>=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
if(ax==77)
{
if(g.x<=48&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
}
if(ax=='a'||ax=='A')
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
else if(ax=='d'||ax=='D')
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
else if(ax=='w'||ax=='W')
{
for(int j=1;j<=4;j++)
{
Sleep(100);
if(g.y!=0&&g.mapp[l][g.y-1][g.x]==' '||g.mapp[l][g.y-1][g.x]=='$')
{
g.ydgb(g.x,g.y);
cout<<" ";
g.y--;
g.ydgb(g.x,g.y);
cout<<z;
}
if(kbhit()!=0)
{
ax=getch();
if(ax==224)
{
ax=getch();
if(ax==75)
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
if(ax==77)
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
}
if(ax=='a'||ax=='A')
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
else if(ax=='d'||ax=='D')
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
if(ax==Sx||ax==SX)
{
system("cls");
sx(g.x,g.y,z,l,1);
}
if(ax==Zt||ax==ZT)
{
system("cls");
if(zt(g.x,g.y,z,l,true)==1)
{
return;
}
ax=0;
}
}
}
}
if(ax==Sx||ax==SX)
{
system("cls");
sx(g.x,g.y,z,l,1);
}
if(ax==Zt||ax==ZT)
{
system("cls");
if(zt(g.x,g.y,z,l,true)==1)
{
return;
}
ax=0;
}
}
while(g.mapp[l][g.y+1][g.x]==' '||g.mapp[l][g.y+1][g.x]=='$')
{
Sleep(100);
g.ydgb(g.x,g.y);
cout<<" ";
g.y+=1;
if(g.y<24)
{
g.ydgb(g.x,g.y);
cout<<z;
}
if(kbhit()!=0)
{
ax=getch();
if(ax==224)
{
ax=getch();
if(ax==75)
{
if(g.x>=0&&g.y<=24&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
if(ax==77)
{
if(g.x<=48&&g.y<=24&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
}
if(ax=='a'||ax=='A')
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
else if(ax=='d'||ax=='D')
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
if(ax==Sx||ax==SX)
{
system("cls");
sx(g.x,g.y,z,l,1);
}
if(ax==Zt||ax==ZT)
{
system("cls");
if(zt(g.x,g.y,z,l,true)==1)
{
return;
}
ax=0;
}
}
if(g.mapp[l][g.y+1][g.x]=='^'||g.mapp[l][g.y][g.x+1]=='<'||g.mapp[l][g.y][g.x-1]=='>'||g.mapp[l][g.y-1][g.x]=='v'||g.y==25)
{
g.ydgb(g.x,g.y);
cout<<" ";
g.x=x;
g.y=y;
g.ydgb(g.x,g.y);
cout<<z;
}
}
if(g.mapp[l][g.y+1][g.x]=='=')
{
int jc=1;
for(int j=1;j<=8&&g.y>1;j++)
{
Sleep(50);
if(g.mapp[l][g.y-1][g.x]==' ')
{
g.ydgb(g.x,g.y);
cout<<" ";
g.y--;
g.ydgb(g.x,g.y);
cout<<z;
if(g.mapp[l][g.y+1][g.x]=='^'||g.mapp[l][g.y][g.x+1]=='<'||g.mapp[l][g.y][g.x-1]=='>'||g.mapp[l][g.y-1][g.x]=='v'||g.y==25)
{
g.ydgb(g.x,g.y);
cout<<" ";
g.x=x;
g.y=y;
g.ydgb(g.x,g.y);
cout<<z;
}
}
if(kbhit()!=0)
{
ax=getch();
if(ax==224)
{
ax=getch();
if(ax==75)
{
if(g.x>=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
if(ax==77)
{
if(g.x<=48&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
}
if(ax=='a'||ax=='A')
{
if(g.x!=0&&g.mapp[l][g.y][g.x-1]==' '||g.mapp[l][g.y][g.x-1]=='$')
{
g.x--;
g.ydgb(g.x,g.y);
cout<<z<<" ";
}
}
else if(ax=='d'||ax=='D')
{
if(g.x!=49&&g.mapp[l][g.y][g.x+1]==' '||g.mapp[l][g.y][g.x+1]=='$')
{
g.ydgb(g.x,g.y);
cout<<" "<<z;
g.x++;
}
}
if(ax=='Z'||ax==SX)
{
system("cls");
sx(g.x,g.y,z,l,1);
}
if(ax==Zt||ax==ZT)
{
system("cls");
if(zt(g.x,g.y,z,l,true)==1)
{
return;
}
ax=0;
}
}
}
}
if(g.mapp[l][g.y+1][g.x]=='^'||g.mapp[l][g.y][g.x+1]=='<'||g.mapp[l][g.y][g.x-1]=='>'||g.mapp[l][g.y-1][g.x]=='v'||g.y==25)
{
g.ydgb(g.x,g.y);
cout<<" ";
g.x=x;
g.y=y;
g.ydgb(g.x,g.y);
cout<<z;
}
if(ax==Zt||ax==ZT)
{
if(zt(g.x,g.y,z,l,true)==1)
{
return;
}
ax=0;
}
if(ax=='Z'||ax=='Z')
{
system("cls");
sx(g.x,g.y,z,l,1);
}
if(g.mapp[l][g.y][g.x]=='$')
{
if(g.cd<=l+1)
{
g.cd=l+1;
g.gb=false;
}
Sleep(10);
system("cls");
g.ydgb(0,0);
cout<<"你赢了!"<<endl;
system("pause");
system("cls");
g.ydgb(0,0);
return ;
}
}
return ;
}
void g1()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第一关:新手教程";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[0][i]<<endl;
}
cout<<g.mapp[0][24];
yx(0,18,g.rw,0);
return;
}
void g2()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第二关:蹦床世界";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[1][i]<<endl;
}
cout<<g.mapp[1][24];
yx(0,22,g.rw,1);
return;
}
void g3()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第三关:小心走错";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[2][i]<<endl;
}
cout<<g.mapp[2][24];
yx(0,23,g.rw,2);
return;
}
void g4()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第四关:暗刺难防";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[3][i]<<endl;
}
cout<<g.mapp[3][24];
yx(0,23,g.rw,3);
return;
}
void g5()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第五关:心跳刺方";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[4][i]<<endl;
}
cout<<g.mapp[4][24];
yx(23,2,g.rw,4);
return;
}
void g6()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第六关:飞得更高";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[5][i]<<endl;
}
cout<<g.mapp[5][24];
yx(0,23,g.rw,5);
return;
}
void g7()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第七关:摔得更惨";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[6][i]<<endl;
}
cout<<g.mapp[6][24];
yx(0,1,g.rw,6);
return;
}
void g8()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第八关:信仰之跃";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[7][i]<<endl;
}
cout<<g.mapp[7][24];
yx(0,23,g.rw,7);
return;
}
void g9()
{
g.ydgb(0,0);
cout<<endl<<endl;
cout<<"\n\n\n\n\n\n\n\n\n 第九关:九转大肠";
Sleep(500);
system("cls");
g.ydgb(0,0);
for(int i=0;i<24;i++)
{
cout<<g.mapp[8][i]<<endl;
}
cout<<g.mapp[8][24];
yx(0,1,g.rw,8);
return;
}
void hy()
{
system("cls");
if(!hydh)
{
g.ydgb(0,0);
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n ============欢迎============ "<<endl;
hydh=true;
Sleep(1000);
system("cls");
}
char x=0;
for(;;)
{
g.ydgb(0,0);
cout<<"\n\n\n\n\n 首页";
x=0;
if(kbhit()!=0)
{
x=getch();
}
if(g.anniu(20,10,10,0,"1.开始游戏",BC,NC)||x=='1')
{
gq();
}
else if(g.anniu(22,13,6,0,"2.存档",BC,NC)||x=='2')
{
g.gcd();
}
else if(g.anniu(22,16,6,0,"3.帮助",BC,NC)||x=='3')
{
bz();
}
else if(g.anniu(19,19,8,0,"Esc.退出游戏",BC,NC)||x==Esc)
{
tc();
}
if(x==SX||x==Sx)
{
sx(0,0,0,0,false);
}
if(x==ZT||x==Zt)
{
zt(0,0,0,0,false);
}
if(x!=0)
{
break;
}
}
system("cls");
Sleep(50);
return ;
}
void gq()
{
system("cls");
int tc=0;
Sleep(50);
g.gdd();
for(;;)
{
g.ydgb(0,0);
char x=0;
cout<<"\n\n\n\n\n 关卡";
if(kbhit()!=0)
{
x=getch();
}
if(x=='1'||((g.cd>=0)?g.anniu(14,9,10,0,g.gqm[0],BC,NC):g.anniu(14,9,10,0,g.fgqm[0],BC,NC)))
{
system("cls");
if(g.cd>=0)
{
g1();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='2'||((g.cd>=1)?g.anniu(27,9,10,0,g.gqm[1],BC,NC):g.anniu(27,9,10,0,g.fgqm[1],BC,NC)))
{
system("cls");
if(g.cd>=1)
{
g2();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='3'||((g.cd>=2)?g.anniu(14,12,10,0,g.gqm[2],BC,NC):g.anniu(14,12,10,0,g.fgqm[2],BC,NC)))
{
system("cls");
if(g.cd>=2)
{
g3();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='4'||((g.cd>=3)?g.anniu(27,12,10,0,g.gqm[3],BC,NC):g.anniu(27,12,10,0,g.fgqm[3],BC,NC)))
{
system("cls");
if(g.cd>=3)
{
g4();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='5'||((g.cd>=4)?g.anniu(14,15,10,0,g.gqm[4],BC,NC):g.anniu(14,15,10,0,g.fgqm[4],BC,NC)))
{
system("cls");
if(g.cd>=4)
{
g5();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='6'||((g.cd>=5)?g.anniu(27,15,10,0,g.gqm[5],BC,NC):g.anniu(27,15,10,0,g.fgqm[5],BC,NC)))
{
system("cls");
if(g.cd>=5)
{
g6();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='7'||((g.cd>=6)?g.anniu(14,18,10,0,g.gqm[6],BC,NC):g.anniu(14,18,10,0,g.fgqm[6],BC,NC)))
{
system("cls");
if(g.cd>=6)
{
g7();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='8'||((g.cd>=7)?g.anniu(27,18,10,0,g.gqm[7],BC,NC):g.anniu(27,18,10,0,g.fgqm[7],BC,NC)))
{
system("cls");
if(g.cd>=7)
{
g8();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x=='9'||((g.cd>=8)?g.anniu(14,21,10,0,g.gqm[8],BC,NC):g.anniu(14,21,10,0,g.fgqm[8],BC,NC)))
{
system("cls");
if(g.cd>=8)
{
g9();
}
else
{
cout<<"\n\n\n\n\n\n\n\n\n\n\n 您还没有解锁此关,请通关前一关后解锁!";
Sleep(500);
system("cls");
}
}
else if(x==Esc||g.anniu(29,21,8,0,"Esc.退出",BC,NC))
{
tc=1;
}
else if(x==SX||x==Sx)
{
sx(0,0,0,0,0);
}
else if(x==ZT||x==Zt)
{
zt(0,0,0,0,0);
}
if(tc==1)
{
tc=0;
system("cls");
break;
}
x=0;
}
system("cls");
return ;
}
int main()
{
cout<<"加载中";
g.ycksbj();
cout<<".";
g.ycgb();
cout<<".";
system("title 跑酷游戏");
cout<<".";
system("mode con cols=50 lines=25");
cout<<".";
g.ys(BC);
cout<<".";
g.gdd();
cout<<".";
system("cls");
cout<<"成功";
csh=true;
for(;;)
{
hy();
}
}
后记:
要小升初考试了,希望能考个好成绩,摇到好初中!!!
也祝每一个看到这篇博客的人事事如意!!!
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » devc++跑酷小游戏4.1.5
发表评论 取消回复