資源描述:
《flappy bird 源代碼》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、#include#include#include#include#include/函數(shù)變量聲明/#definePR_Boxprintf("■")#definePR_Goldprintf("★")#definePR_Agprintf("☆")#definePR_FBirdprintf("Ю")#definePR_DBirdprintf("Ф")#definePR_Landprintf("┳┳┯")#definePR_Bg_TLprintf("╔")#definePR_Bg_TRprintf("╗
2、")#definePR_Bg_DLprintf("╚")#definePR_Bg_DRprintf("╝")#definePR_Bg_Xprintf("═")#definePR_Bg_Yprintf("║")#definePR_Blankprintf("");intGrade=1,C_Gold=0,C_Ag=0,Score=0,Delay_time=1000,Max_blank=9,Distance=18;structBirds{intx,y;intcondition;};BirdsBird=(Birds)malloc(sizeof(Birds));structBg{intx,y;in
3、tl_blank;intreward[9];Bgpri;Bgnext;};BgBg1=newBg[sizeof(Bg)];voidPosition(intx,inty){COORDpos={x-1,y-1};HANDLEOut=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(Out,pos);}voidCreatBird(){Bird->x=41;Bird->y=10;Bird->condition=0;}voidCreatBg(){BgBg2=(Bg)malloc(sizeof(Bg));Bg1->x=90;Bg1->
4、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;}voidInsertBg(Bgp){inttemp;BgBgs=(Bg)malloc(sizeof(Bg));Bgs->x=p->pri->x+Distance;Bgs->l_blank=Max_blank-Grade;srand((int)time(0));temp=rand();if(te
5、mp%2==0)//++{if((temp%4+p->pri->y+Max_blank-Grade)<21)Bgs->y=p->pri->y+temp%4;elseBgs->y=p->pri->y;}else{if((p->pri->y-temp%4)>2)Bgs->y=p->pri->y-temp%4;elseBgs->y=p->pri->y;}Bgs->pri=p->pri;Bgs->next=p;p->pri->next=Bgs;p->pri=Bgs;}voidCheck_Bg(Bgq){Bgp=q;inti=0,temp;while(++i<=5){if(p->x>-4)p=p
6、->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;elsep->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;elsep->y=p->y;p->x=p->pri->x+Distance;p->l_blank=Max_blank-Grade;}}}}voidL
7、oop_Bg(Bgq){Bgp=q;inti=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++;}}}voidPrt_Bg(Bgq){Bgp=q;inti=0,k,j;while(++i<=5){if(p->x>0&&p->x<=78){for(k=2;ky;k++){Position(p->x+