飞扬的小鸟1.0测试版

飞扬的小鸟1.0测试版
为了实战一下图形库的绘制所以尝试了一次动态游戏的制作,事实上这个游戏的代码实现十分简单,只要花时间多加入几个功能就可以了,下面先把1.0测试版放上来,后续再完善功能。
注1:VC++6.0IDE 没有自带图形绘制相关头文件和插件,如果要实现图形绘制需要自行下载EASYX,这个东西的安装十分容易,去百度搜一下EASYX下载就行了,按着步骤安装,然后编写代码的时候加上#include<graphics.h>就行了。
因为我更喜欢使用vscode,但是我还没搞明白怎么让VS code适配EASYX,如果有人知道可以告诉我一下。。。。
注2:因为图片素材什么的做的不好,等后续找到适合图片的时候再一起上传。
代码如下:

#include<iostream>
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
#define BGIMAGE_WIDH 300     //屏幕宽度 
#define BGIMAGE_HEIGH 500    //屏幕高度 
#define piper_high 1664      //水管最大高度 


using namespace std;

void personactions();   //用户操作 
void Next();            //更新水管 
int isbreak();

IMAGE bgimage;       //背景 
IMAGE birdsimage;    //鸟 
IMAGE F_birdsimage;  //反补鸟 
IMAGE pipersimage;   //水管 
IMAGE D_pipersimage; //反补水管 
IMAGE gameoverimage;      //游戏结束图片


int bird_x=100,bird_y=300;
int piper_x=150,piper_y=-1400,D_piper_y=400;
int gameover_x=50,gameover_y=200;
int next_x=1,next_y=1;
int lenth;
int speed_of_screan=50;
int situation;


int main(void)
{
	//绘制屏幕 
	initgraph(BGIMAGE_WIDH,BGIMAGE_HEIGH);
	
	//显示背景 、鸟、上下水管 
	loadimage(&bgimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\背景\\1.png",BGIMAGE_WIDH,800);  
	loadimage(&birdsimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\鸟\\1.png",42,30);            
	//	loadimage(&F_birdsimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\鸟\\1-1.png",NOTSRCERASE);
	loadimage(&pipersimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\水管\\1.png",30);
	loadimage(&D_pipersimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\水管\\2.png",30);
	
	//打印图片和水管和鸟 
	putimage(0,-300,&bgimage);	
	putimage(piper_x,piper_y,&pipersimage);
	putimage(piper_x,D_piper_y,&D_pipersimage);
	putimage(bird_x,bird_y,&birdsimage);
	putimage(bird_x,bird_y,&F_birdsimage);
	
	// 更改种子 
	srand(time(0));
	
	while (1)
	{
		bird_y+=5;
		piper_x-=5;
		
		//开始绘制 
		BeginBatchDraw();
		putimage(0,-300,&bgimage);	
		putimage(piper_x,piper_y,&pipersimage);
		putimage(piper_x,D_piper_y,&D_pipersimage);
		putimage(bird_x,bird_y,&F_birdsimage);
		putimage(bird_x,bird_y,&birdsimage);
		EndBatchDraw();
		
		//减速屏幕 
		Sleep(speed_of_screan);
		
		//多项操作 
		personactions();
		Next();

		situation=isbreak();

		switch (situation)
		{
		case 0:
			loadimage(&gameoverimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\文字\\gameover.png",208,48);
			putimage(gameover_x,gameover_y,&gameoverimage);
			Sleep(3000);
			return 0;
			break;
			
		default:
			break;
		}
	}
	return 0;
}

//用户操作 
void personactions(){
	if(kbhit()){
		if(GetAsyncKeyState(VK_SPACE)||GetAsyncKeyState(VK_LBUTTON)){
			bird_y-=10;
		}
	}
}

//更新水管 
void Next(){
	if(piper_x<0){
		piper_x=BGIMAGE_WIDH;
		piper_y=rand()%piper_high;
		piper_y=-piper_y;
		D_piper_y=rand()%450;
		
		while(piper_y>-(piper_high-BGIMAGE_HEIGH+30)||D_piper_y<(piper_high+piper_y+50)){
			piper_y=rand()%piper_high;
			piper_y=-piper_y;
			D_piper_y=rand()%450;
		}
	}
	
}

//碰撞检测
int isbreak(){
	if((bird_x+30==piper_x)&&(bird_y<=(piper_high+piper_y)||bird_y+30>=D_piper_y)||bird_x<0||bird_y>BGIMAGE_HEIGH){
		return 0;
	}
}

几个函数可以自己去EASYX的帮助文档里面看看包含参数是什么,这里先不多做过多解释。
代码实现的图片如下:(话说怎么截动图来着)
在这里插入图片描述在这里插入图片描述
在这里插入图片描述

飞扬的小鸟2.0测试版
经过昨天半天的补充测试,基本上能够正常的玩这个游戏,但是得分系统还没有完善,并且界面还不是很友好,素材也存在一些问题,但是基本上游戏的基础以及完成,接下来只要进行一些完善就行了。
虽然游戏已经完成了,但是没办法移植到别人的电脑上,目前不知道怎么解决,如果有知道的请告诉我一下。。。
代码如下:

#include<iostream>
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>
#define BGIMAGE_WIDH 300     //屏幕宽度 
#define BGIMAGE_HEIGH 500    //屏幕高度 
#define piper_high 1664      //水管最大高度 
#define COINS_WIDTH 32
#define COINS_HIGH 32

using namespace std;

void personactions();   //用户操作 
void Next();            //更新水管 
int isbreak();
void coinsadd();
void show_coins();

IMAGE bgimage;       //背景 
IMAGE birdsimage;    //鸟 
IMAGE F_birdsimage;  //反补鸟 
IMAGE pipersimage;   //水管 
IMAGE D_pipersimage; //反补水管 
IMAGE gameoverimage;      //游戏结束图片
IMAGE coins_First,coins_Second,coins_Third;
IMAGE coins_all;

RECT getscore={0,0,0,0};


int bird_x=100,bird_y=300;
int piper_x=150,piper_y=-1400,D_piper_y=400;
int gameover_x=50,gameover_y=200;
int coins_x=piper_x,coins_y=300;
int next_x=1,next_y=1;
int speed_of_screan=50;
int situation;
int choose=1,real=0;
char point='0';

int main(void)
{
	//绘制屏幕 
	initgraph(BGIMAGE_WIDH,BGIMAGE_HEIGH,SHOWCONSOLE);
	
	//显示背景 、鸟、上下水管 
	loadimage(&bgimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\背景\\1.png",BGIMAGE_WIDH,800);  
	loadimage(&birdsimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\鸟\\1.png",42,30);            
	//loadimage(&F_birdsimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\鸟\\1-1.png",NOTSRCERASE);
	loadimage(&pipersimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\水管\\1.png",30);
	loadimage(&D_pipersimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\水管\\2.png",30);
	loadimage(&coins_First,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\金币\\1.png",24,24);
	loadimage(&coins_Second,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\金币\\2.png",24,24);
	loadimage(&coins_Third,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\金币\\2.png",24,24);
	loadimage(&coins_all,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\金币\\6.png");
	//打印图片和水管和鸟 
	putimage(0,-300,&bgimage);	
	putimage(piper_x,piper_y,&pipersimage);
	putimage(piper_x,D_piper_y,&D_pipersimage);
	putimage(bird_x,bird_y,&birdsimage);
	putimage(bird_x,bird_y,&F_birdsimage);
	
	/*putimage(coins_x,coins_y,&coins_Second);
	putimage(coins_x,coins_y,&coins_First);
	putimage(coins_x,coins_y,&coins_Third);
	putimage(coins_x,coins_y,&coins_First);*/
	putimage(0,0,&coins_all);
	show_coins();

	// 更改种子 
	srand(time(0));
	
	while (1)
	{
		bird_y+=5;
		piper_x-=5;
		coins_x=piper_x;

		//开始绘制 
		BeginBatchDraw();
		putimage(0,-300,&bgimage);	
		putimage(piper_x,piper_y,&pipersimage);
		putimage(piper_x,D_piper_y,&D_pipersimage);
		putimage(bird_x,bird_y,&F_birdsimage);
		putimage(bird_x,bird_y,&birdsimage); 	

		if(piper_x<0)
			choose=1;
		if(choose&&piper_x>=0)
		show_coins();//putimage(coins_x,coins_y,&coins_Second);
	    EndBatchDraw();
		

		//减速屏幕 
		Sleep(speed_of_screan);
		
		//多项操作 
		personactions();
		Next();
		situation=isbreak();
		coinsadd();

		switch (situation)
		{
		case 0:
			loadimage(&gameoverimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\文字\\gameover.png",208,48);
			putimage(gameover_x,gameover_y,&gameoverimage);
			cout<<point<<endl;
			setbkmode(TRANSPARENT);
			rectangle(getscore.left,getscore.top,getscore.right,getscore.bottom);
			setfillcolor(BLUE);
			fillrectangle(getscore.left,getscore.top,getscore.right,getscore.bottom);
			drawtext(point,&getscore,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
			Sleep(3000);
			return 0;
			break;
		case 1:
		    choose=0;
			break;
		default:
			break;
		}
	}
	closegraph();
	return 0;
}

//用户操作 
void personactions(){
	if(kbhit()){
		if(GetAsyncKeyState(VK_SPACE)||GetAsyncKeyState(VK_LBUTTON)){
			bird_y-=10;
		}
	}
}

//更新水管 和金币
void Next(){
	if(piper_x<0){
		piper_x=BGIMAGE_WIDH;
		coins_x=piper_x;
		piper_y=rand()%piper_high;
		piper_y=-piper_y;
		D_piper_y=rand()%450;
		coins_y=rand()%500;

		while(piper_y>-(piper_high-BGIMAGE_HEIGH+30)||D_piper_y<(piper_high+piper_y+50)){
			piper_y=rand()%piper_high;
			piper_y=-piper_y;
			D_piper_y=rand()%450;
		}
	}
	while(coins_y<=(piper_high+piper_y)||coins_y+24>=D_piper_y)
	coins_y=rand()%500;
	
}

//碰撞检测
int isbreak(){
	if((bird_x+30==piper_x)&&(bird_y+10 <(piper_high+piper_y)||bird_y+20>=D_piper_y)
		||bird_x<0
		||bird_y>BGIMAGE_HEIGH
		||((bird_x==piper_x)&&(bird_y+10<(piper_high+piper_y)))
		||((bird_x>piper_x&&bird_x<piper_x+28)&&(bird_y+22>D_piper_y))){
		cout<<bird_y<<" "<<piper_y+1664<<" "<<bird_y-(1664+piper_y)<<endl;
		return 0;
	}
	if((bird_x>=coins_x && bird_x<=coins_x+24 && bird_y>=coins_y && bird_y<=coins_y+24) 
		||(bird_x+42>=coins_x &&bird_x+42<=coins_x+24 && bird_y>=coins_y && bird_y<=coins_y+24)
		||(bird_x+42>=coins_x &&bird_x+42<=coins_x+24 && bird_y+30>=coins_y && bird_y+30<=coins_y+24)
		||(bird_x>=coins_x && bird_x<=coins_x+24 && bird_y+30>=coins_y && bird_y+30<=coins_y+24)){
		real=1;
		return 1;
	}
}
//判断增加金币
void coinsadd(){
	if(real&&bird_x==coins_x){
		point++;
		cout<<point<<endl;
		real=0;
	}
	if(bird_x>coins_x+30)
		real=0;
}

//显示金币
void show_coins(){
	static int i=1;
	putimage(coins_x,coins_y,COINS_WIDTH,32,&coins_all,(i-1)*COINS_WIDTH,0);
	i++;
	if(i>=4)
		i=1;
}

飞扬的小鸟2.8测试版
2.8测试版完善并优化了界面,整体界面变得比较友好,但是金币的颜色稍微有点问题,如果背景的颜色和金币的颜色冲突的话,金币会变成难看的紫色,这个问题解决方案是用能适配的背景,游戏界面变大,一次界面中能看到两根柱子,两个金币,连贯度提高了,基本上游戏的基础已经出现了,接下来的一段时间先优化开始界面和结束界面,等完善功能以后再开发金币商城,2.8测试版本的代码如下,(这样似乎页面有点冗长,但是这也是没有办法的了)
注:这次写的代码确实不好,但是实在懒得修改算法,一改很多东西都得一起改,下次有时间再做,这次的代码还是过程性编程,没有使用oop思想,可以改进一下如何使用oop思想进行编程,从而能衍生出相类似的游戏。

#include<iostream>
#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#include<stdlib.h>

#define BGIMAGE_WIDH 600     //屏幕宽度 
#define BGIMAGE_HEIGH 500    //屏幕高度 
#define piper_high 1664      //水管最大高度 
#define COINS_WIDTH 32       
#define COINS_HIGH 32

using namespace std;

void personactions();   //用户操作 
void Next();            //更新水管 
int  isbreak();          //碰撞检测
void coinsadd();        //金币增加判断
void show_coins();      //打印金币
void show_coins_T();
void show_image();      //打印图片
void loadphotos();      //加载图片
void show();            //打印综合图片
void move();            //人物移动
void gameover();        //游戏结束判断
void control_speed();   //控制速度

IMAGE bgimage;          //背景 
IMAGE bgimage_T;         
IMAGE birdsimage;       //鸟 
IMAGE F_birdsimage;     //反补鸟 
IMAGE pipersimage;      //上水管 
IMAGE D_pipersimage;    //下水管 
IMAGE gameoverimage;    //游戏结束图片
IMAGE coins_allbg;      //金币背景
IMAGE coins_all;        //金币


RECT getscore={0,0,0,0};//矩形坐标


int bird_x=100,bird_y=300;

int piper_x=250,piper_y=-1400,D_piper_y=400;
int piper_x_T=550,piper_y_T=-1500,D_piper_y_T=450;

int coins_x=piper_x,coins_y=300;
int coins_x_T=piper_x_T,coins_y_T=200;

int gameover_x=50,gameover_y=200;

int next_x=1,next_y=1;
int speed_of_screan=50;
int situation;
int choose=1,choose_T=1,real=0,real_T=0;
int point=0;

int main(void)
{
	show();

	while (1)
	{
		//人物移动
		move();

		//打印综合图片
		show_image();

		//多项操作 
		personactions();
		Next();
		situation=isbreak();
		coinsadd();

		//碰撞结果的判定
		switch (situation)
		{
		case 0:
			gameover();
			return 0;
			break;
		case 1:
		    choose=0;
			break;
		case 2:
		    choose_T=0;
		default:
			break;
		}
		control_speed();
	}
	closegraph();
	return 0;
}

//用户操作 
void personactions(){
	if(kbhit()){
		if(GetAsyncKeyState(VK_SPACE)||GetAsyncKeyState(VK_LBUTTON)){
			bird_y-=10;
		}
	}
}

//更新水管 和金币
void Next(){
	if(piper_x<0){
		piper_x=BGIMAGE_WIDH;
		coins_x=piper_x;
		piper_y=rand()%piper_high;
		piper_y=-piper_y;
		D_piper_y=rand()%450;
		coins_y=rand()%500;

		while(piper_y>-(piper_high-BGIMAGE_HEIGH+30)||D_piper_y<(piper_high+piper_y+50)){
			piper_y=rand()%piper_high;
			piper_y=-piper_y;
			D_piper_y=rand()%450;
		}

	}
	if(piper_x_T<0){
		piper_x_T=BGIMAGE_WIDH;
		coins_x_T=piper_x_T;
		piper_y_T=rand()%piper_high;
		piper_y_T=-piper_y_T;
		D_piper_y_T=rand()%450;
		coins_y_T=rand()%500;

		while(piper_y_T>-(piper_high-BGIMAGE_HEIGH+30)||D_piper_y_T<(piper_high+piper_y_T+50)){
			piper_y_T=rand()%piper_high;
			piper_y_T=-piper_y_T;
			D_piper_y_T=rand()%450;
		}
	}
	while(coins_y<=(piper_high+piper_y)||coins_y+24>=D_piper_y)
	coins_y=rand()%500;

	while(coins_y_T<=(piper_high+piper_y_T)||coins_y_T+24>=D_piper_y_T)
	coins_y_T=rand()%500;
	
}

//碰撞检测
int isbreak(){
	if((bird_x+30==piper_x)&&(bird_y+10 <(piper_high+piper_y)||bird_y+20>=D_piper_y)
		||bird_x<0
		||bird_y>BGIMAGE_HEIGH
		||((bird_x==piper_x)&&(bird_y+10<(piper_high+piper_y)))
		||((bird_x>piper_x&&bird_x<piper_x+28)&&(bird_y+22>D_piper_y))){
		cout<<bird_y<<" "<<piper_y+1664<<" "<<bird_y-(1664+piper_y)<<endl;
		return 0;
	}

	if((bird_x+30==piper_x_T)&&(bird_y+10 <(piper_high+piper_y_T)||bird_y+20>=D_piper_y_T)
		||bird_x<0
		||bird_y>BGIMAGE_HEIGH
		||((bird_x==piper_x_T)&&(bird_y+10<(piper_high+piper_y_T)))
		||((bird_x>piper_x_T&&bird_x<piper_x_T+28)&&(bird_y+22>D_piper_y_T))){
		cout<<bird_y<<" "<<piper_y_T+1664<<" "<<bird_y-(1664+piper_y_T)<<endl;
		return 0;
	}

	if((bird_x>=coins_x && bird_x<=coins_x+24 && bird_y>=coins_y && bird_y<=coins_y+24) 
		||(bird_x+42>=coins_x &&bird_x+42<=coins_x+24 && bird_y>=coins_y && bird_y<=coins_y+24)
		||(bird_x+42>=coins_x &&bird_x+42<=coins_x+24 && bird_y+30>=coins_y && bird_y+30<=coins_y+24)
		||(bird_x>=coins_x && bird_x<=coins_x+24 && bird_y+30>=coins_y && bird_y+30<=coins_y+24)){
		real=1;
		return 1;
	}
	if((bird_x>=coins_x_T && bird_x<=coins_x_T+24 && bird_y>=coins_y_T && bird_y<=coins_y_T+24) 
		||(bird_x+42>=coins_x_T &&bird_x+42<=coins_x_T+24 && bird_y>=coins_y_T && bird_y<=coins_y_T+24)
		||(bird_x+42>=coins_x_T &&bird_x+42<=coins_x_T+24 && bird_y+30>=coins_y_T && bird_y+30<=coins_y_T+24)
		||(bird_x>=coins_x_T && bird_x<=coins_x_T+24 && bird_y+30>=coins_y_T && bird_y+30<=coins_y_T+24)){
		real_T=1;
		return 2;
	}

}
//判断增加金币
void coinsadd(){
	if(real&&(bird_x==coins_x+30)){
		point++;
		cout<<point<<endl;
		real=0;
	}
	if(real_T&&(bird_x==coins_x_T+30)){
		point++;
		cout<<point<<endl;
		real_T=0;
	}
	if(bird_x>coins_x+30)
		real=0;
	if(bird_x>coins_x_T+30)
		real_T=0;
}

//显示金币
void show_coins(){
	static int i=1;
	putimage(coins_x,coins_y,COINS_WIDTH,32,&coins_allbg,(i-1)*COINS_WIDTH,0,NOTSRCERASE);
	putimage(coins_x,coins_y,COINS_WIDTH,32,&coins_all,(i-1)*COINS_WIDTH,0,SRCINVERT);
	
	i++;
	if(i>=8)
		i=1;
}

void show_coins_T(){
	static int j=1;
	putimage(coins_x_T,coins_y_T,COINS_WIDTH,32,&coins_allbg,(j-1)*COINS_WIDTH,0,NOTSRCERASE);
	putimage(coins_x_T,coins_y_T,COINS_WIDTH,32,&coins_all,(j-1)*COINS_WIDTH,0,SRCINVERT);

	j++;
	if(j>=8)
		j=1;
}
//打印图片
void show_image(){
	//开始绘制 
	BeginBatchDraw();
	//绘制背景
	if(point<10)
	putimage(0,-300,&bgimage);
	else
	putimage(0,-300,&bgimage_T);
		
	//绘制水管
	putimage(piper_x,piper_y,&pipersimage);
	putimage(piper_x,D_piper_y,&D_pipersimage);	

	putimage(piper_x_T,piper_y_T,&pipersimage);
	putimage(piper_x_T,D_piper_y_T,&D_pipersimage);	

	//绘制鸟
	putimage(bird_x,bird_y,&F_birdsimage,NOTSRCERASE);
	putimage(bird_x,bird_y,&birdsimage,SRCINVERT); 
	
	//判断并绘制金币
	if(piper_x<0)
		choose=1;
	if(choose&&piper_x>=0)
	show_coins();

	if(piper_x_T<0)
		choose_T=1;
	if(choose_T&&piper_x_T>=0)
	show_coins_T();

	EndBatchDraw();
		
	//减速屏幕 
	Sleep(speed_of_screan);
		
}
//加载图片
void loadphotos(){
	//背景图片
	loadimage(&bgimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\背景\\1.png",BGIMAGE_WIDH,800); 
	loadimage(&bgimage_T,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\背景\\2.png",BGIMAGE_WIDH,800);
	//鸟
	loadimage(&birdsimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\鸟\\1.png",42,30);            
	loadimage(&F_birdsimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\鸟\\1-2.png",42,30);
	//水管
	loadimage(&pipersimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\水管\\1.png",30);
	loadimage(&D_pipersimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\水管\\2.png",30);
	//金币
	loadimage(&coins_allbg,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\金币\\7.png");
	loadimage(&coins_all,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\金币\\6.png");
	//游戏结束图片
	loadimage(&gameoverimage,"D:\\TeqGin\\development\\code\\c c++\\program\\飞扬的小鸟\\素材\\image\\文字\\gameover.png",208,48);
}
//综合打印
void show(){
	//绘制屏幕 
	initgraph(BGIMAGE_WIDH,BGIMAGE_HEIGH,SHOWCONSOLE);
	
	//显示背景 、鸟、上下水管 
	loadphotos();

	//打印图片和水管和鸟 
	show_image();
	
	// 更改种子 
	srand(time(NULL));
	
}
//人物移动
void move(){
	bird_y+=5;

	piper_x-=5;
	piper_x_T-=5;

	coins_x=piper_x;
	coins_x_T=piper_x_T;
}
//游戏结束操作
void gameover(){
	putimage(gameover_x,gameover_y,&gameoverimage);

	cout<<point<<endl;

	/*setbkmode(TRANSPARENT);
	rectangle(getscore.left,getscore.top,getscore.right,getscore.bottom);
	setfillcolor(BLUE);
	fillrectangle(getscore.left,getscore.top,getscore.right,getscore.bottom);
	drawtext(point,&getscore,DT_CENTER|DT_VCENTER|DT_SINGLELINE);*/

	Sleep(3000);
}
//速度控制
void control_speed(){
	if(point>=10)
		speed_of_screan=30;

	if(point>=20)
		speed_of_screan=10;
}

在这里插入图片描述

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值