#include"StdAfx.h" 

#include<stdio.h>

#include<stdlib.h>

#include<conio.h>
#include<time.h>
#include<Windows.h>
/********函数变量声明********/
#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 = , C_Gold = , C_Ag = , Score = , Delay_time = ,Max_blank=,Distance=; struct Birds
{
int x, y;
int condition;
}; Birds *Bird = (Birds*)malloc(sizeof(Birds)); struct Bg
{
int x, y;
int l_blank;
int reward[];
Bg *pri;
Bg *next;
}; Bg *Bg1 = new Bg[sizeof(Bg)]; void Position(int x, int y)
{
COORD pos = { x - , y - };
HANDLE Out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(Out, pos);
} void CreatBird()
{
Bird->x=;
Bird->y=;
Bird->condition =;
} void CreatBg()
{
Bg *Bg2 = (Bg*)malloc(sizeof(Bg)); Bg1->x=;Bg1->y =;
Bg2->x=Bg1->x+Distance;Bg2->y =; 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());
temp=rand();
if(temp%==)//++
{
if((temp%+p->pri->y+Max_blank-Grade)<)
Bgs->y=p->pri->y+temp%;
else
Bgs->y=p->pri->y;
}
else
{
if((p->pri->y-temp%)>)
Bgs->y=p->pri->y-temp%;
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=,temp;
while(++i<=)
{
if(p->x>-)
p=p->next;
else
{
srand((int)time());
temp=rand();
if(temp%==)//++
{
if((temp%+p->y+Max_blank-Grade)<)
p->y=p->y+temp%;
else
p->y=p->y;
p->x=p->pri->x+Distance;
p->l_blank=Max_blank-Grade;
}
else
{
if((p->y-temp%)>)
p->y=p->y-temp%;
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=;
while(++i<=)
{
p->x=p->x-;
p=p->next ;
if(Bird->x==p->x)
{
Score+=;
if(Score%==&&Grade<)
Grade++;
}
}
} void Prt_Bg(Bg *q)
{
Bg *p=q;int i=,k,j;
while(++i<=)
{
if(p->x>&&p->x<=)
{ for(k=;k<p->y;k++)
{
Position(p->x+,k);
PR_Box;PR_Box;PR_Blank
}
Position(p->x,p->y);
PR_Box;PR_Box;PR_Box;PR_Blank;
Position(p->x,p->y+p->l_blank);
PR_Box;PR_Box;PR_Box;PR_Blank;
k=k+p->l_blank+;
for(k;k<=;k++)
{
Position(p->x+,k);
PR_Box;PR_Box;PR_Blank;
}
Position(p->x,);
for(k=;k<Distance/-;k++)
PR_Land;
}
p=p->next;
if(p->x==)
{
for(j=;j<p->y;j++)
{ Position(p->x+,j);
PR_Blank;PR_Blank;
}
Position(p->x+,p->y);
PR_Blank;PR_Blank;PR_Blank;
Position(p->x+,p->y+Max_blank-Grade);
PR_Blank;PR_Blank;PR_Blank;
j=j+Max_blank-Grade+;
for(j;j<=;j++)
{Position(p->x+,j);
PR_Blank;PR_Blank;
}
}
}
}
void PrtBg()
{
int i;
Position(,);PR_Bg_TL;
Position(,);PR_Bg_TR;
Position(,);PR_Bg_DL;
Position(,);PR_Bg_DR;
for(i=;i<=;i+=)
{
Position(i,);PR_Bg_X;
Position(i,);PR_Bg_X;
}
/*for(i=2;i<=23;i++)
{ Position(1,i);PR_Bg_Y;printf("%d",i-1);
Position(79,i);PR_Bg_Y;
}*/
}
void PrtBird()
{
Position(Bird->x,Bird->y-);
PR_Blank;
Position(Bird->x,Bird->y);
PR_FBird;
Position(,);
printf("Score:%d",Score);
}
int CheckYN(Bg *q)
{
Bg *p=q;int i=;
while(++i<=)
{
if(Bird->y>)
return ;
if(Bird->x==p->x&&Bird->y<=p->y)
return ;
if((Bird->x==p->x||Bird->x==p->x+||Bird->x==p->x+)&&Bird->y==p->y)
return ;
if(Bird->x==p->x&&Bird->y>p->y+p->l_blank)
return ;
if((Bird->x==p->x||Bird->x==p->x+||Bird->x==p->x+)&&Bird->y==p->y+p->l_blank)
return ;
p=p->next;
}
return ;
}
void Prtfirst()
{
printf("══════════════════════════════════════\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■\n");
printf(" ■■ ■■ C语言版 Flappy Bird\n");
printf(" ■■ ■■ 瞎搞人:yyposs\n");
printf(" ■■ ■■ 瞎搞日期:2014.2\n");
printf(" ■■ ■■ 耗时:4小时\n");
printf(" ■■■ ■■ 游戏说明:\n");
printf(" ■■ 1-按上箭头使鸟起飞\n");
printf(" ■■ 2-等级越高,难度越大!\n");
printf(" Ю ■■■\n");
printf("\n");
printf(" \n\n\n\n\n\n\n\n");
printf(" ┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳┳┯┳\n");
system("pause");
Position(,);
int i=;
while(i++<*)
PR_Blank;
}
void main()
{
int i=;char ch;
Prtfirst(); PrtBg();
CreatBg();
InsertBg(Bg1);
InsertBg(Bg1);
InsertBg(Bg1);
CreatBird();
while()
{
if(!CheckYN(Bg1))
break;
Check_Bg(Bg1);
Prt_Bg(Bg1);
PrtBird();
Loop_Bg(Bg1);
Bird->y=Bird->y+;
if(GetAsyncKeyState(VK_UP))
{
Position(Bird->x,Bird->y-);
PR_Blank;
Bird->y=Bird->y-;
}
while(i++<);
{
Sleep();
}
i=;
}
Position(,);
printf("You Lost!");
Position(,);
system("pause");
}

在校内上看到这份代码,对vs进行些配置后可以运行,mark在此。

转载:Flappy Bird源代码 win32 console版的更多相关文章

  1. Flappy bird源代码(略吊)

    #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<time.h> #inc ...

  2. HTML5 版的flappy bird

    Flappy Bird这款简单的小游戏累计下载量已经超过5000万次,每天收入至少5万美元.然而,2月10日其开发者Dong Nguyen却将Flappy Bird从苹果App Store和Googl ...

  3. C语言版flappy bird黑白框游戏

    在此记录下本人在大一暑假,2014.6~8这段时间复习C语言,随手编的一个模仿之前很火热的小游戏----flappy bird.代码bug基本被我找光了,如果有哪位兄弟找到其他的就帮我留言下吧,谢谢了 ...

  4. 也来山寨一版Flappy Bird (js版)

    随着Flappy Bird的火爆,各种实现的版也不断出现,于是也手痒简单实现了一版. 其实本来只是想实现一下这只笨鸟的飞翔运动的,后来没忍住,就直接实现一个完整游戏了…… 因为这个游戏本身实现起来就没 ...

  5. flappy bird游戏源代码揭秘和下载

    转:http://blog.csdn.net/touchsnow/article/details/19071961 背景: 最近火爆全球的游戏flappy bird让笔者叹为观止,于是花了一天的时间山 ...

  6. 教你从头到尾利用DQN自动玩flappy bird(全程命令提示,GPU+CPU版)【转】

    转自:http://blog.csdn.net/v_JULY_v/article/details/52810219?locationNum=3&fps=1 目录(?)[-] 教你从头到尾利用D ...

  7. cocos2dx-html5 实现网页版flappy bird游戏

    我也是第一次使用cocos2d_html5,对js和html5也不熟,看引擎自带的例子和引擎源码,边学边做,如果使用过cocos2d-x的话,完成这个游戏还是十分简单的.游戏体验地址: http:// ...

  8. [Win32::Console]Perl终端版生命游戏

    环境,WinXP/Win7  Perl 5.16 默认循环1000次,按ESC提前退出 use strict; use Term::ReadKey; use Win32::Console; use T ...

  9. 自己动手写游戏:Flappy Bird

    START:最近闲来无事,看了看一下<C#开发Flappy Bird游戏>的教程,自己也试着做了一下,实现了一个超级简单版(十分简陋)的Flappy Bird,使用的语言是C#,技术采用了 ...

随机推荐

  1. $GLOBALS['HTTP_RAW_POST_DATA']与$_POST的区别

    $HTTP_RAW_POST_DATA   The RAW / uninterpreted HTTP POst information can be accessed with:   $GLOBALS ...

  2. Ubuntu 下安装mysqlclient报错

    pip3 install mysqlclient 报错信息 问题描述: Complete output from command python setup.py egg_info: /bin/sh: ...

  3. 【Linux命令】nohup和&差异,查看进程和终止进程!

    最近在开发dueros的技能,官方提供的PHPSDK中有多个实力,而运行实例的命令如下是 nohup php -S 0.0.0.0:8029 myindex.php & 从命令来看,肯定是在8 ...

  4. Python学习笔记:py2exe打包Python程序

    使用py2exe将一个Python程序打包成一个exe程序,这样Python程序也可以在没有安装Python的环境中运行Python程序了.使用这个工具需要写一个用于打包的setup.py文件(名称可 ...

  5. apply(), applymap(), map()

    Pandas 中map, applymap and apply的区别  https://blog.csdn.net/u010814042/article/details/76401133/ Panda ...

  6. 树莓派开发板入门学习笔记1:[转]资料收集及树莓派系统在Ubuntu安装

    参考教程(微雪课堂):http://www.waveshare.net/study/portal.php 树莓派实验室: http://shumeipai.nxez.com/2014/12/21/us ...

  7. OverflowError:django signed integer is greater than maximum

    在学习一对一查询的时候,打印作者的电话时报了这个错 alex = Author.objects.filter(name='alex').first() print(alex.authordetail. ...

  8. Mysql主键一致时,可以进行在元数据上的操作

    insert into daliy_hit_counter(day,slot,cnt) values(12,12,1) on duplicate key update cnt = cnt +1 dal ...

  9. 金阳光Android自动化测试第一季

    第一季:http://www.chuanke.com/v1983382-106000-218422.html 第一节:Android自动化预备课程基础(上)     1. 基于坐标点触屏:monkey ...

  10. JAVA里的别名机制

    别名现象主要出现在赋值的问题上: 对基本数据类型的赋值是很简单的.基本数据类型存储了实际的数值,而并非指向一个对象的引用,所以在为其赋值的时候,是直接将一个地方的内容复制到了另一个地方.例如,对基本数 ...