飞翔的小鸟-C语言版(完善ing)

闲来无事,在网易云和童老师学了点打发时间小游戏

安利一下童晶老师的C语言教学,有C基础和对小游戏感兴趣的可以看看,做出来成就感爆棚~

分享链接:点击打开链接


飞翔的小鸟-C语言版

其中有个问题是:“小鸟”和“障碍物”在同一水平轴时,会出现“障碍物右移情况”;

                                但是不是太想改,虽然会变得简单,但是可以让图案看起来不是那么的“单调”;

                                PS:运行界面改成白底黑字会更好看一些,(习惯透明度80%);

                                飞翔的小鸟-C语言版(完善ing)_第1张图片

源码(不带要写注释了~哈哈):

#include 
#include 
#include 
#include 
#include 

int h,w;
int c=0;
int score=0;//得分
int xn_x,xn_y;
int b1,b2,b3;
char asd;

void startup(){
	h=15;
	w=25;

	xn_x=0;
	xn_y=w/3;

	b3=w;
	b1=h/4;
	b2=h/2;

}
void show(){
	int i,j;
	char dad;
	if(c==0){
		printf("======================================\n");
		printf("=           ---飞翔的小鸟---         =\n");
		printf("=       空格------控制小鸟移动       =\n");
		printf("=           不要开中文输入法         =\n");
		printf("=                                    =\n");
		printf("=                                    =\n");
		printf("=         闪屏纯属正                =\n");
		printf("=                         ----倾白白  =\n");
		printf("======================================\n");
		c++;
		dad=getch();
	}
	system("cls");
	for(i=0;i=b2))
				printf("█");
			else 
				printf(" ");
		}
		printf("\n");
	}
	printf("当前得分:%d",score);
}
void wuguan(){
	int randx;
		if(xn_y==b3){
		if(xn_x>b1&&xn_x
每天比昨天更好一些

你可能感兴趣的:(C语言小游戏)