使用devc++编写的,devc++可完美运行
建议设计步骤:
实现小鸟加速下落——>实现小鸟按键上升——>实现障碍物移动出现——>实现小鸟碰撞障碍物时游戏结束——>实现障碍物循环出现
#include<stdio.h>
#include<conio.h>
#include<windows.h>
int bird_x,bird_y,score;
int width,birdup;
double high;
int block_x,block1_y,block2_y;
int bar_x,bar1_y,bar2_y;
int flag;
void hidecursor(){
//隐藏光标
CONSOLE_CURSOR_INFO cursor_info={
1,0};//第二个值为0表示隐藏光标
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
}
void gotoxy(int x,int y){
//将光标移到(x,y)位置
HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X=x;
pos.Y=y;
SetConsoleCursorPosition(handle,pos);
}
startup(){
hidecursor();
high=20;width=30;
bird_x=width/2;
bird_y=high/2;
birdup=