devc++跑酷小游戏3.0.0

2024-02-19 16:28
文章标签 c++ 小游戏 dev 3.0 跑酷

本文主要是介绍devc++跑酷小游戏3.0.0,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

 导航:

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 

 【更新内容每日废话

关卡数量没变,每个都微调了一下。作者再此保证能过,都测试过,过不了技术问题

新增了一个暂停功能,如果不小心选错关可以用'x'或'X'进入暂停界面选择退出,不用重开了

重磅消息:

我终于学会文件操作了,预计可以在4.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='@';
string mapp1[6][25]={{"                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","         -----  --  -- - -----                   |","    -                                            |","---- --                                          |","                               ^                 |","                                                 |","                                                 |","----^--=                                         |","                                   ---=          |","                                                 |","                                              |- |",	"                                               $ |","                                             ----|","^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",},{"                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                               ==^               |","                                      -  --^     |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                              ==^                |","              --- <                              |","               <                                 |","            ---                                  |", "          --                                 <^ ^|","       --                                    <  ||","--^ ----               -                      ^ $|", "                         ----=                >--|","^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",},{"                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","                                                 |","    ==-                                          |","           ^===^    > <    -                     |","           <    > >    <                         |","                  >    <                         |","                       <                         |","                                                 |","           -----                                 |","  ==                                             |","                                                ^|","                -=-=-==----                     $|","                                              ^--|","                                              <  |", "             ===                                 |","                                    >     <      |", "-==                                  ^---^  ==   |", "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",   },{"                                                 |","                                                 |","                                                 |","                              ------        ---  |","                             -       ---  --   ^ |","                       <--->                     |","    <->             --                        <^ |","                  --                           <$|","  =^    <->                                     <|"," =            ---^                               |","                                  ^              |","                                  |              |","                                 <|=             |","                                   <             |","                                    >            |"," >                                   ---^<^--^-  |","= -- -- - -- --- -- - --- ---                  - |","                              --                 |","                                                 |","                                                 |","                                                 |","                                   ^   ^         |","                             <>   < >  >         |","----^--^-^----^^^---^^-^^^--=  ---   --  ---^---=|","^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",},{"|>                                              <|","|>                                              <|","|>                                              <|","|>                      ^        ^              <|",//21 0"|> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <|","|>                                              <|","|>   ^^^^^                                      <|","|>                               ^              <|","|> -  -  -   -       -   -       <-  -   -      <|","|>                      ^                       <|","|>    ^^^^^^            <          ^^^^^^^      <|","|>                                              ||","|>   |     |    |            |              |   ||","|>   |     |^^^^^^^^^^^^^^^^^^  ^           |   ||","|>                                              ||","|>         ^^^^^^^^             ^   ^^^^^^^^^^^^<|","|>   ^                ^ ^        <->       ^   <<|","|>   <>               <>      ^                 <|","|> ^     ^             ^      <   ^^^^^^^       ||","||^^^^^^^^^^^^^^^^^^^^^>   |^               ^   ||","||    ^         ^     <| - |>                   ||","||    >               <| $ |>                   ||",	"||                      =-=    ^                ||","||                                              ||","^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",},{"                                           -    -|","                                                $|","                                            ---- |","---                     ---                  |   |","                                             |   |","   =      ^^            =                  =^    |","          <>                                     |","                                           -----=|","                 ^^                              |","                 <>                       =      |","                           =                     |","    =                 ^^                         |","                      <>                         |","                     -      ^^                   |","                  ^^        <>           =       |","                  <>   ---=                      |","                                 ^^              |","   =                             <>              |","                                                 |","                 <  --=                          |","                                      ^^         |","                                      <>=        |",	"                                                 |","--=                                              |","^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^",}};
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 gq();
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);
void gq_zt(int x,int y,int l,bool pd);
void gq_dy(string x,int l);
int hy();void gq_ys(int x)
{SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),x);    //x代表的是第几号颜色 前面的GetStdHandle(STD_OUTPUT_HANDLE)是获取当前窗口权柄,简单来说就是让这个颜色加在这个页面return;
}
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,bool pd)
{if(pd)//判断pd是否为真,可以写成if(pd==1) {system("cls");cout<<"刷新中...";sb_ycksbj();sb_yc();system("title 跑酷游戏");system("mode con cols=50 lines=25");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");system("cls");}return;
} 
void gq_dy(int l)
{for(int i=0;i<24;i++){cout<<mapp1[l][i];}cout<<mapp1[l][24];return;
} 
int gq_zt(bool pd)
{if(pd){system("cls");cout<<"\n\n\n\n\n\n";cout<<"                       暂停中\n\n\n";cout<<"                       1.退出\n\n\n";cout<<"                       2.返回\n\n\n";cout<<"                       3.存档\n\n\n";cout<<"                     4.退出游戏";a=0; a=getch()-'0';switch(a) {case 1 :{system("cls");return a;break;}case 2 :{system("cls");return a;break;	}case 3 :{system("cls");return a;break;}case 4 :{system("cls");cout<<endl<<endl<<"    再见!    "<<endl<<endl;_sleep(750);system("cls");exit(0);break; }default:{break;}}}	else{system("cls");cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n";cout<<"                       暂停中"<<endl;cout<<"                      空格返回";for(;;){if(getch()==' ')return 0;}}return 0; 
} 
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(x1,yy1,z,l,1);}} }}}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(x1,yy1,z,l,1);}}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(x1,yy1,z,l,1);}}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(x1,yy1,z,l,1);}} }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(ax==120||ax==88){switch(gq_zt(1)){case 0 :{break;}case 1 :{return;break;}case 2 :{ax=0;for(int i=0;i<24;i++){cout<<mapp1[l][i]<<endl;}cout<<mapp1[l][24];sb_yd(x1,yy1);cout<<z;break;}case 3 :{break;}case 4 :{system("cls");system("mode con cols=15 lines=5");cout<<endl<<endl<<"     再见!    "<<endl<<endl;_sleep(750);system("cls");exit(0);break; }}}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");
//	gq_dy(0);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;
}
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,0,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,22,rw,5);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");}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"<<endl;cout<<"              1.新手教程  2.蹦床世界\n\n"<<endl; cout<<"              3.明枪易躲,暗箭难防(1)\n\n"<<endl;cout<<"              4.明枪易躲,暗箭难防(2)\n\n"<<endl;cout<<"              5.心跳刺方  6.飞得更高\n\n"<<endl;cout<<"                     7.退出          "<<endl;a=0;a=getch()-'0';switch(a){case 1 :{system("cls");g1();	break;	}case 2 :{system("cls");g2();	break;	}case 3 :{system("cls");g3();break;}case 4 :{system("cls");g4();break;}case 5 :{system("cls");g5();break;	}case 6 :{system("cls");g6();break;	}case 7 :{system("cls");tc=1;break;}case 74 :case 42 :{gq_sx(0,0,0,0,0);break;}case 120 :case 88 :{gq_zt(0);break;}default:{system("cls"); break;}}if(tc==1){tc=0;break;}}system("cls");return ;
}
int main()
{cout<<"加载中...";sb_ycksbj();sb_yc();system("title 跑酷游戏");system("mode con cols=50 lines=25");system("cls");for(;;){hy();switch(a)  {case 1 :{system("cls");gq();	break;}case 2 :{system("cls");system("mode con cols=15 lines=5");cout<<endl<<endl<<"     再见!    "<<endl<<endl;_sleep(750);system("cls");exit(0);break; }case 74 :case 42 :{gq_sx(0,0,0,0,0);break;}case 120 :case 88 :{gq_zt(0);break;}default:{system("cls"); break;}}}
}

这篇关于devc++跑酷小游戏3.0.0的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/725235

相关文章

C++中实现调试日志输出

《C++中实现调试日志输出》在C++编程中,调试日志对于定位问题和优化代码至关重要,本文将介绍几种常用的调试日志输出方法,并教你如何在日志中添加时间戳,希望对大家有所帮助... 目录1. 使用 #ifdef _DEBUG 宏2. 加入时间戳:精确到毫秒3.Windows 和 MFC 中的调试日志方法MFC

深入理解C++ 空类大小

《深入理解C++空类大小》本文主要介绍了C++空类大小,规定空类大小为1字节,主要是为了保证对象的唯一性和可区分性,满足数组元素地址连续的要求,下面就来了解一下... 目录1. 保证对象的唯一性和可区分性2. 满足数组元素地址连续的要求3. 与C++的对象模型和内存管理机制相适配查看类对象内存在C++中,规

在 VSCode 中配置 C++ 开发环境的详细教程

《在VSCode中配置C++开发环境的详细教程》本文详细介绍了如何在VisualStudioCode(VSCode)中配置C++开发环境,包括安装必要的工具、配置编译器、设置调试环境等步骤,通... 目录如何在 VSCode 中配置 C++ 开发环境:详细教程1. 什么是 VSCode?2. 安装 VSCo

C++11的函数包装器std::function使用示例

《C++11的函数包装器std::function使用示例》C++11引入的std::function是最常用的函数包装器,它可以存储任何可调用对象并提供统一的调用接口,以下是关于函数包装器的详细讲解... 目录一、std::function 的基本用法1. 基本语法二、如何使用 std::function

【C++ Primer Plus习题】13.4

大家好,这里是国中之林! ❥前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站。有兴趣的可以点点进去看看← 问题: 解答: main.cpp #include <iostream>#include "port.h"int main() {Port p1;Port p2("Abc", "Bcc", 30);std::cout <<

C++包装器

包装器 在 C++ 中,“包装器”通常指的是一种设计模式或编程技巧,用于封装其他代码或对象,使其更易于使用、管理或扩展。包装器的概念在编程中非常普遍,可以用于函数、类、库等多个方面。下面是几个常见的 “包装器” 类型: 1. 函数包装器 函数包装器用于封装一个或多个函数,使其接口更统一或更便于调用。例如,std::function 是一个通用的函数包装器,它可以存储任意可调用对象(函数、函数

C++11第三弹:lambda表达式 | 新的类功能 | 模板的可变参数

🌈个人主页: 南桥几晴秋 🌈C++专栏: 南桥谈C++ 🌈C语言专栏: C语言学习系列 🌈Linux学习专栏: 南桥谈Linux 🌈数据结构学习专栏: 数据结构杂谈 🌈数据库学习专栏: 南桥谈MySQL 🌈Qt学习专栏: 南桥谈Qt 🌈菜鸡代码练习: 练习随想记录 🌈git学习: 南桥谈Git 🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈�

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

06 C++Lambda表达式

lambda表达式的定义 没有显式模版形参的lambda表达式 [捕获] 前属性 (形参列表) 说明符 异常 后属性 尾随类型 约束 {函数体} 有显式模版形参的lambda表达式 [捕获] <模版形参> 模版约束 前属性 (形参列表) 说明符 异常 后属性 尾随类型 约束 {函数体} 含义 捕获:包含零个或者多个捕获符的逗号分隔列表 模板形参:用于泛型lambda提供个模板形参的名

4B参数秒杀GPT-3.5:MiniCPM 3.0惊艳登场!

​ 面壁智能 在 AI 的世界里,总有那么几个时刻让人惊叹不已。面壁智能推出的 MiniCPM 3.0,这个仅有4B参数的"小钢炮",正在以惊人的实力挑战着 GPT-3.5 这个曾经的AI巨人。 MiniCPM 3.0 MiniCPM 3.0 MiniCPM 3.0 目前的主要功能有: 长上下文功能:原生支持 32k 上下文长度,性能完美。我们引入了