资源简介
C++写的著名游戏flappy bird.已经通过调试。支持多种功能,难度可以调节。
代码片段和文件信息
#include
#include
#include
#include
#include
/********函数变量声明********/
#define PR_Box printf(“■“)
#define PR_Gold printf(“★“)
#define PR_Ag printf(“☆“)
#define PR_FBird printf(“Ю“)
#define PR_DBird printf(“Ф“)
#define PR_Land printf(“┳┳┯“)
#define PR_Bg_TL printf(“╔“)
#define PR_Bg_TR printf(“╗“)
#define PR_Bg_DL printf(“╚“)
#define PR_Bg_DR printf(“╝“)
#define PR_Bg_X printf(“═“)
#define PR_Bg_Y printf(“║“)
#define PR_Blank printf(“ “);
int Grade = 1 C_Gold = 0 C_Ag = 0 Score = 0 Delay_time = 1000Max_blank=9Distance=18;
struct Birds
{
int x y;
int condition;
};
Birds *Bird = (Birds*)malloc(sizeof(Birds));
struct Bg
{
int x y;
int l_blank;
int reward[9];
Bg *pri;
Bg *next;
};
Bg *Bg1 = new Bg[sizeof(Bg)];
void Position(int x int y)
{
COORD pos = { x - 1 y - 1 };
HANDLE Out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(Out pos);
}
void CreatBird()
{
Bird->x=41;
Bird->y=10;
Bird->condition =0;
}
void CreatBg()
{
Bg *Bg2 = (Bg*)malloc(sizeof(Bg));
Bg1->x=90;Bg1->y =8;
Bg2->x=Bg1->x+Distance;Bg2->y =9;
Bg1->l_blank =Max_blank-Grade;
Bg2->l_blank =Max_blank-Grade;
Bg1->next=Bg2;
Bg1->pri=Bg2;
Bg2->next=Bg1;
Bg2->pri=Bg1;
}
void InsertBg(Bg *p)
{int temp;
Bg *Bgs = (Bg*)malloc(sizeof(Bg));
Bgs->x=p->pri->x+Distance;
Bgs->l_blank =Max_blank-Grade;
srand((int)time(0));
temp=rand();
if(temp%2==0)//++
{ if((temp%4+p->pri->y+Max_blank-Grade)<21)
Bgs->y=p->pri->y+temp%4;
else
Bgs->y=p->pri->y;
}
else
{
if((p->pri->y-temp%4)>2)
Bgs->y=p->pri->y-temp%4;
else
Bgs->y=p->pri->y;
}
Bgs->pri=p->pri;
Bgs->next =p;
p->pri->next=Bgs;
p->pri =Bgs;
}
void Check_Bg(Bg *q)
{ Bg *p=q;int i=0temp;
while(++i<=5)
{ if(p->x>-4)
p=p->next;
else
{ srand((int)time(0));
temp=rand();
if(temp%2==0)//++
{ if((temp%4+p->y+Max_blank-Grade)<21)
p->y=p->y+temp%4;
else
p->y=p->y;
p->x=p->pri->x+Distance;
p->l_blank=Max_blank-Grade;
}
else
{
if((p->y-temp%4)>2)
p->y=p->y-temp%4;
else
p->y=p->y;
p->x=p->pri->x+Distance;
p->l_blank=Max_blank-Grade;
}
}
}
}
void Loop_Bg(Bg *q)
{
Bg *p=q;int i=0;
while(++i<=5)
{p->x=p->x-1;
p=p->next ;
if(Bird->x==p->x)
{Score+=1;
if(Score%4==0&&Grade<4)
Grade++;
}
}
}
void Prt_Bg(Bg *q)
{ Bg *p=q;int i=0kj;
while(++i<=5)
{ if(p->x>0&&p->x<=78)
{ for(k=2;ky;k++)
{ Position(p->x+1k);
PR_Box;PR_
相关资源
- N皇后C++源代码---回溯法、遗传算法、
- 车牌识别C++实现
- VC++ 迷宫游戏
- 校园导航c++实现
- VC++压缩解压zip文件支持密码
- 将数字转换为大写汉字的c++程序
- vc++ opengl 下雪场景实现
- compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
- 自己用c++ 做的一个浏览器 简单 但是
- c++ 工资管理系统
- VC++制作的屏幕录像
- 人工势场法C++版及利用opencv(or matl
- Effective C++中文版 超清pdf
- 相位解卷绕unwrap
- Floyd算法C++
- C++进程优先级调度进程优先级调度进
- BP神经网络VC++实现
- 基于C++的图书馆管理系统
- c++五子棋人机对战源程序
- vc知识库大讲堂c++教程.txt
- C++实现通用链表
- c++成语接龙代码.rar
- 银行储蓄系统c++
- OpenCV+C++图像处理项目14个
- 山大C++实验
- 四变量遗传算法求最小值程序C++
- 用VS2015+opencv3.4.2+C++编写Yolov3目标检测
- funcode太空战机c++
- ntripclient-c++
- c++ 课程设计报告 可直接交作业版
评论
共有 条评论