C语言/C++雷霆战机代码(终极版)

#include <stdio.h>
#include <easyx.h>
#include <time.h>
#include <Mmsystem.h>
#pragma comment(lib,"winmm.lib")
#define WIDTH   600
#define HEIGHT  850
#define bullet_max  5000      //我方飞机子弹最大量
#define enemy_bul_max 1500     //敌方飞机子弹最大量
#define enemy1_hp 30          //敌方飞机生命值
#define enemy2_hp 50
#define enemy3_hp 30
#define enemy4_hp 10000
#define enemy5_hp 12000
IMAGE bgimg;                                //主界面图片
IMAGE bkimg0;                               
IMAGE bkimg1;
IMAGE bkimg2;
IMAGE bkimg3;
IMAGE bkimg4;
IMAGE bkimg5;
IMAGE Myplane[2];                           //飞机图片个数
IMAGE Enemy1[2];                            //小飞机
IMAGE Enemy2[2];                            //中飞机
IMAGE Enemy2Bullet[2];                      //中飞机子弹
IMAGE Enemy3[2];                            //横行飞机
IMAGE Enemy3Bullet[2];                      //横行飞机子弹
IMAGE Enemy4[2];                            //第二关boss
IMAGE Enemy4Bullet[2];                      //第二关boss子弹
IMAGE Enemy5[2];                            //第三关boss
IMAGE Enemy5Bullet[2];                      //第三关boss子弹
IMAGE Lighter[2];                           //飞机大招
IMAGE AntiAddictionNotice;                  //防沉迷公告
IMAGE HowToPlay;                            //玩法说明
//加载图片
void loadimg();
//初始化游戏
void initGame();
//加载主界面
void DrawInterface(ExMessage* msg);
//绘制游戏
void DrawGame();
//更新背景
void UpdateBack();
//更新飞机
void UpdatePlane();
//绘制子弹
void DrawBullet();
//绘制雷霆
void DrawLighter();
//子弹移动
void MoveBullet();
//雷霆移动
void MoveLighter();
//关卡转换
void level_change();
//失败界面
void FailMenu();
//结束界面
void EndMenu();
//进入每一关的初始分数
void Judge();
//敌机移动机制
void EnemyMove();
//判定子弹碰撞敌机
void Bulletcrush();
//判定大招攻击敌机
void LighterCrush();
//创建敌机
void EnemyCreat_L1();
void EnemyCreat_L2();
void EnemyCreat_L3();
void EnemyCreat_L4();
//敌机清除
void EnemyClean();
//敌机产生子弹
void Enemy_Bullet_Creat();
//敌机子弹移动
void Enemy_Bullet_Move();
//敌机子弹打击
void Enemy_Bullet_Crush();
//碰撞敌机
void EnemyCrush();
//显示分数血量
void Print();
//挑战模式
void ChallengeMode();
//定义音效(用于开启或关闭音效)
struct Music
{
	bool isExit;
}music;
//定义我方飞机类
struct Myplane
{
	int   x;
	int   y;
	int   hp;
	int   width = 95;
	int   height = 90;
	bool  isExit;                            //飞机是否存在
}myplane[1]; 
IMAGE Bullet[2];                             //子弹图片个数
//定义我方飞机子弹类
struct Bullet
{
	int   x1;
	int	  y1;
	int	  x2;
	int	  y2;
	bool  isExit;                             //是否存在
} bullet[bullet_max];                         //子弹个数
struct Lighter
{
	int x;
	int y;
	bool isExit;
}lighter[1];
//定义敌方飞机类
struct Enemyplane
{
	double   x;
	double   y;
	int   hp;
	int   width;
	int   height;
	bool  isExit;
}enemy1[10], enemy2[5], enemy3[5], enemy4[1], enemy5[1];
//定义敌方飞机子弹类
struct Enemybullet
{
	int   x;
	int   y;
	int   hp;
	int   atk;                                //用于后面判断打击
	int   width;
	int   height;
	bool  isExit;
} enemy2_bullet[enemy_bul_max], enemy3_bullet[enemy_bul_max], enemy4_bullet[enemy_bul_max], enemy5_bullet[enemy_bul_max];
int   bky0, bky1, bk1y0, bk1y1, bk2y0, bk2y1, bk3y0, bk3y1;
int score = 0;                                //5000通过第一关,8000分第二关boss出现,12000分进入第三关
int enemy2_direct0 = 1;                       //用于下面判断敌机向左向右移动
int enemy3_direct0 = 1;
int enemy3_direct1 = 0;
int enemy3_direct2 = 1;
int enemy3_direct3 = 0;
int enemy3_direct4 = 1;
int enemy4_direct0 = 1;
int level_change_count = 1;
int flag = 0;
int flag1 = 1;
int main();
int level()
{
	if (flag == 0)
	{
		return 0;
	}
	else if (flag == 1)
	{
		if (score > 5000 && score < 12000)
		{
			return 2;//第二关
		}
		else if (score < 5000)
		{
			return 1;//返回第一关
		}
		else if (score > 12000)
		{
			return 3;//第三关
		}
		else if (score > 17000)
		{
			return 4;//结束界面
		}
	}
	else if (flag == 2)
	{
		return 5;
	}
}
void loadimg()
{
	//主界面图片
	loadimage(&bgimg, L"bg.jpg");
	//关卡背景图片
	if (level() == 1)
	{
		loadimage(&bkimg0, L"bk.jpg");
	}
	else if (level() == 2)
	{
		loadimage(&bkimg1, L"bk1.jpg");
	}
	else if (level() == 3)
	{
		loadimage(&bkimg2, L"bk2.jpg");
	}
	else if(level() == 5)
	{
		loadimage(&bkimg4, L"bk4.jpg");
	}
	loadimage(&bkimg3, L"bk3.jpg");
	loadimage(&bkimg5, L"bk5.jpg");
	//我方飞机图片
	loadimage(&Myplane[0], L"uiPlane0.jpg");
	loadimage(&Myplane[1], L"uiPlane1.jpg");
	//加载子弹
	loadimage(&Bullet[0], L"bullet0.jpg");
	loadimage(&Bullet[1], L"bullet1.jpg");
	//敌机1
	loadimage(&Enemy1[0], L"enemy10.jpg");
	loadimage(&Enemy1[1], L"enemy11.jpg");
	//敌机2
	loadimage(&Enemy2[0], L"enemy20.jpg");
	loadimage(&Enemy2[1], L"enemy21.jpg");
	loadimage(&Enemy2Bullet[0], L"enemybullet10.jpg");
	loadimage(&Enemy2Bullet[1], L"enemybullet11.jpg");
	//敌机3
	loadimage(&Enemy3[0], L"enemy10.jpg");
	loadimage(&Enemy3[1], L"enemy11.jpg");
	loadimage(&Enemy3Bullet[0], L"enemybullet20.jpg");
	loadimage(&Enemy3Bullet[1], L"enemybullet21.jpg");
	//敌机4
	loadimage(&Enemy4[0], L"enemy30.jpg");
	loadimage(&Enemy4[1], L"enemy31.jpg");
	loadimage(&Enemy4Bullet[0], L"enemybullet40.jpg");
	loadimage(&Enemy4Bullet[1], L"enemybullet41.jpg");
	//敌机5
	loadimage(&Enemy5[0], L"enemy50.jpg");
	loadimage(&Enemy5[1], L"enemy51.jpg");
	loadimage(&Enemy5Bullet[0], L"enemybullet50.jpg");
	loadimage(&Enemy5Bullet[1], L"enemybullet51.jpg");
	//飞机大招
	loadimage(&Lighter[0], L"lighter0.jpg");
	loadimage(&Lighter[1], L"lighter1.jpg");
	//加载防沉迷公告页面
	loadimage(&AntiAddictionNotice, L"防沉迷公告.jpg");
	//加载玩法说明页面
	loadimage(&HowToPlay, L"玩法说明.jpg");
}
DWORD WINAPI MouseMusic(LPVOID lpVoid)
{
	mciSendString(L"open 鼠标点击.mp3", 0, 0, 0);
	mciSendString(L"play 鼠标点击.mp3 wait", 0, 0, 0);
	mciSendString(L"close 鼠标点击.mp3", 0, 0, 0);
	return 0;
	//多线程播放音乐
}
bool isInRect(ExMessage* msg, int x, int y, int width, int height)
{
	//判断鼠标是否在某个区域
	if (msg->x > x && msg->x < x + width && msg->y > y && msg->y < y + height)
	{
		return true;
	}
	return false;
}
enum MenuOp
{
	Start,               //开始游戏按钮
	Challenge,           //挑战模式按钮
	Description,           //玩法说明按钮
	AntiNotice, //防沉迷公告
	Home,                 //主菜单
	End,
	End2,
	Pause,
	Exit
};
enum MenuOp menuState = Home;//开始在主菜单
void DrawInterface(ExMessage* msg)
{
	if (GetAsyncKeyState(VK_LBUTTON))
	{
		CreateThread(0, 0, MouseMusic, 0, 0, 0);
		switch (menuState)
		{
		case Home:
			//开始游戏按钮
			if (isInRect(msg, 141, 539, 305, 80))
			{
				menuState = Start;
			}
			//挑战模式按钮
			if (isInRect(msg, 141, 635, 303, 80))
			{
				menuState = Challenge;
			}
			//玩法说明按钮
			if (isInRect(msg, 0, 790, 131, 44))
			{
				menuState = Description;
			}
			//防沉迷公告按钮
			if (isInRect(msg, 447, 790, 161, 44))
			{
				menuState = AntiNotice;
			}
			break;
		case Start:
			break;
		case Challenge:
			break;
		case Description:
			if (isInRect(msg, 473, 806, 125, 42))
				menuState = Home;
			break;
		case AntiNotice:
			if (isInRect(msg, 461, 794, 125, 42))
				menuState = Home;
			break;
		case End:
			if (isInRect(msg, 32, 798, 126, 45))
			{
				menuState = Home;
				initGame();
				score = 0;
			}
			if (isInRect(msg, 453, 800, 126, 45))
			{
				menuState = Exit;
			}
			break;
		case End2:
			if (isInRect(msg, 32, 798, 126, 45))
			{
				menuState = Home;
				initGame();
				score = 0;
			}
			if (isInRect(msg, 453, 800, 126, 45))
			{
				menuState = Exit;
			}
			break;
		case Pause:
			if (isInRect(msg, 14, 800, 125, 45))
			{
				menuState = Home;
				initGame();
				score = 0;
			}
			if (isInRect(msg, 455, 800, 125, 45))
			{
				menuState = Exit;
			}
			if (isInRect(msg, 230, 266, 129, 42))
			{
				if (flag1 == 1)
				{
					flag = 1;
				}
				else if (flag1 == 2)
				{
					flag = 2;
				}
			}
			if (isInRect(msg, 225, 125, 129, 42))
			{
				music.isExit = true;
			}
			if (isInRect(msg, 230, 195, 129, 42))
			{
				music.isExit = false;
			}
			break;
		}
	}
	if (menuState == Home)
	{
		putimage(0, 0, &bgimg);
	}
	else
	{
		if (menuState == Description)
		{
			putimage(0, 0, &HowToPlay);
		}
		else if (menuState == AntiNotice)
		{
			putimage(0, 0, &AntiAddictionNotice);
		}
		else if (menuState == Start)
		{
			flag = 1;
		}
		else if (menuState == Challenge)
		{
			flag = 2;
		}
		else if (menuState == Exit)
		{
			exit(0);
		}
		else if (menuState == End)
		{
			int x = 10;
			int y = 20;
			putimage(0, 0, &bkimg3);
			TCHAR time_test1[50];
			TCHAR time_test2[50];
			_stprintf(time_test1, _T("恭喜您!"));
			_stprintf(time_test2, _T("您的本次得分为:%d"), score);
			setbkmode(TRANSPARENT);
			settextstyle(40, 0, L"华文行楷");
			outtextxy(x, y, time_test1);
			outtextxy(x, y + 50, time_test2);
		}
		else if (menuState == End2)
		{
			int x = 10;
			int y = 20;
			putimage(0, 0, &bkimg3);
			TCHAR time_test1[50];
			TCHAR time_test2[50];
			TCHAR time_test3[50];
			_stprintf(time_test1, _T("许多年以后,"));
			_stprintf(time_test2, _T("当我再次仰望那片星空"));
			_stprintf(time_test3, _T("战机的轰鸣声依旧回荡在耳畔..."));
			setbkmode(TRANSPARENT);
			settextstyle(40, 0, L"华文行楷");
			outtextxy(x, y, time_test1);
			outtextxy(x, y + 50, time_test2);
			outtextxy(x, y + 100, time_test3);
		}
		else if (menuState == Pause)
		{
			putimage(0, 0, &bkimg5);
		}
	}
}
bool Timer(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;//申请静态变量,DWORD实质就是一个无符号长整型类型
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
bool Timer1(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
DWORD WINAPI PlaneFireMusic(LPVOID lpVoid)
{
	if (music.isExit == true)
	{
		mciSendString(L"open 发射子弹.mp3", 0, 0, 0);
		mciSendString(L"play 发射子弹.mp3 wait", 0, 0, 0);
		mciSendString(L"close 发射子弹.mp3", 0, 0, 0);
	}
	return 0;
}
DWORD WINAPI PlaneLighterMusic(LPVOID lpVoid)
{
	if (music.isExit == true)
	{
		mciSendString(L"open 发射大招.mp3", 0, 0, 0);
		mciSendString(L"play 发射大招.mp3 wait", 0, 0, 0);
		mciSendString(L"close 发射大招.mp3", 0, 0, 0);
	}
	return 0;
}
DWORD WINAPI Boom(LPVOID lpVoid)
{
	if (music.isExit == true)
	{
		mciSendString(L"open 爆炸.mp3", 0, 0, 0);
		mciSendString(L"play 爆炸.mp3 wait", 0, 0, 0);
		mciSendString(L"close 爆炸.mp3", 0, 0, 0);
	}
	return 0;
}
void DrawGame()
{
	BeginBatchDraw();
	loadimg();
	//绘制关卡背景
	if (level() == 1)
	{
		putimage(0, bky0, &bkimg0);
		putimage(0, bky1, &bkimg0);
	}
	else if (level() == 2)
	{
		putimage(0, bk1y0, &bkimg1);
		putimage(0, bk1y1, &bkimg1);
	}
	else if(level() == 3)
	{
		putimage(0, bk2y0, &bkimg2);
		putimage(0, bk2y1, &bkimg2);
	}
	else if(level() == 5)
	{
		putimage(0, bk3y0, &bkimg4);
		putimage(0, bk3y1, &bkimg4);
	}
	//绘制我方飞机子弹(透明贴图)
	int i;
	for (i = 0; i < 1; i++)
	{
		if (myplane[i].isExit)                       //如果飞机存在,则绘制飞机
		{
			putimage(myplane[i].x, myplane[i].y, &Myplane[0], SRCPAINT);
			putimage(myplane[i].x, myplane[i].y, &Myplane[1], SRCAND);
		}
	}
	for (i = 0; i < bullet_max; i++)
	{                                           //遍历所有子弹,若子弹存在则贴图
		if (bullet[i].isExit)
		{                                       //SRCPAINT三元光栅操作码(用于实现透明贴图)
			putimage(bullet[i].x1, bullet[i].y1, &Bullet[0], SRCPAINT);
			putimage(bullet[i].x1, bullet[i].y1, &Bullet[1], SRCAND);
			putimage(bullet[i].x2, bullet[i].y2, &Bullet[0], SRCPAINT);
			putimage(bullet[i].x2, bullet[i].y2, &Bullet[1], SRCAND);
		}
	}
	for (i = 0; i < 10; i++)//敌机1
	{
		if (enemy1[i].isExit)
		{
			putimage(enemy1[i].x, enemy1[i].y, &Enemy1[0], SRCPAINT);
			putimage(enemy1[i].x, enemy1[i].y, &Enemy1[1], SRCAND);
		}
	}

	for (i = 0; i < 5; i++)//敌机2
	{
		if (enemy2[i].isExit)
		{
			putimage(enemy2[i].x, enemy2[i].y, &Enemy2[0], SRCPAINT);
			putimage(enemy2[i].x, enemy2[i].y, &Enemy2[1], SRCAND);
		}
	}
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy2_bullet[i].isExit)
		{
			putimage(enemy2_bullet[i].x, enemy2_bullet[i].y, &Enemy2Bullet[0], SRCPAINT);
			putimage(enemy2_bullet[i].x, enemy2_bullet[i].y, &Enemy2Bullet[1], SRCAND);
		}
	}

	for (i = 0; i < 5; i++)//敌机3
	{
		if (enemy3[i].isExit)
		{
			putimage(enemy3[i].x, enemy3[i].y, &Enemy3[0], SRCPAINT);
			putimage(enemy3[i].x, enemy3[i].y, &Enemy3[1], SRCAND);
		}
	}
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy3_bullet[i].isExit)
		{
			putimage(enemy3_bullet[i].x, enemy3_bullet[i].y, &Enemy3Bullet[0], SRCPAINT);
			putimage(enemy3_bullet[i].x, enemy3_bullet[i].y, &Enemy3Bullet[1], SRCAND);
		}
	}
	for (i = 0; i < 1; i++)
	{
		if (enemy4[i].isExit)
		{
			putimage(enemy4[i].x, enemy4[i].y, &Enemy4[0], SRCPAINT);
			putimage(enemy4[i].x, enemy4[i].y, &Enemy4[1], SRCAND);
		}
	}
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy4_bullet[i].isExit)
		{
			putimage(enemy4_bullet[i].x, enemy4_bullet[i].y, &Enemy4Bullet[0], SRCPAINT);
			putimage(enemy4_bullet[i].x, enemy4_bullet[i].y, &Enemy4Bullet[1], SRCAND);
		}
	}
	for (i = 0; i < 1; i++)
	{
		if (enemy5[i].isExit)
		{
			putimage(enemy5[i].x, enemy5[i].y, &Enemy5[0], SRCPAINT);
			putimage(enemy5[i].x, enemy5[i].y, &Enemy5[1], SRCAND);
		}
	}
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy5_bullet[i].isExit)
		{
			putimage(enemy5_bullet[i].x, enemy5_bullet[i].y, &Enemy5Bullet[0], SRCPAINT);
			putimage(enemy5_bullet[i].x, enemy5_bullet[i].y, &Enemy5Bullet[1], SRCAND);
		}
	}
	for (i = 0; i < 1; i++)
	{
		if (lighter[i].isExit)
		{
			putimage(lighter[i].x, lighter[i].y, &Lighter[0], SRCPAINT);
			putimage(lighter[i].x, lighter[i].y, &Lighter[1], SRCAND);
		}
	}
	EndBatchDraw();
}
bool Timer_enemycreat(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
bool Timer2(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
bool Timer_enemy2_bullet_creat(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
bool Timer_enemy3_bullet_creat(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
bool Timer_enemy4_bullet_creat(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
bool Timer_enemy5_bullet_creat(int ms)//定时器
{
	static DWORD t1 = 0, t2 = 0;
	if (t2 - t1 > ms)
	{
		t1 = t2;
		return true;
	}
	t2 = clock();
	return false;
}
void EnemyMove()
{
	int i;
	for (i = 0; i < 10; i++)//最小敌机前进,不发射子弹
	{
		if (enemy1[i].isExit == true)//如果敌机1存在
		{
			enemy1[i].y += 0.5;
			if (enemy1[i].y > HEIGHT)
			{
				enemy1[i].isExit = false;//如果敌机1出界则判定为不存在
			}
		}
	}
	for (i = 0; i < 5; i++)//中飞机,缓慢前进,并发射子弹
	{
		if (enemy2[i].isExit == true)
		{
			enemy2[i].y += 0.7;
			if (enemy2[i].y > HEIGHT)
			{
				enemy2[i].isExit = false;
			}
		}
	}
	for (i = 0; i < 5; i++)//横行飞机,左右移动,偶尔前进,并发射子弹
	{
		if (enemy3[i].isExit == true)
		{
			if (i == 0)//型号为0的飞机,奇数向左,偶数向右,且先向左
			{
				if (enemy3[i].y < HEIGHT / 2)
				{
					enemy3[i].y += 10;
				}
				else
				{
					if (enemy3_direct0 % 2 == 1)
					{
						enemy3[i].x -= 2;
						if (enemy3[i].x < 0)
						{
							enemy3_direct0++;
						}
					}
					if (enemy3_direct0 % 2 == 0)
					{
						enemy3[i].x += 2;
						if (enemy3[i].x + enemy3[i].width > WIDTH)
						{
							enemy3_direct0++;
						}
					}
				}

			}
			if (i == 1)//型号为1的飞机,奇数向右,偶数向左,且先向右边
			{
				if (enemy3[i].y < HEIGHT / 2)//先移动到画面中
				{
					enemy3[i].y += 10;
				}
				else
				{
					if (enemy3_direct1 % 2 == 0)
					{
						enemy3[i].x -= 2;
						if (enemy3[i].x < 0)
						{
							enemy3_direct1++;
						}
					}
					if (enemy3_direct1 % 2 == 1)
					{
						enemy3[i].x += 2;
						if (enemy3[i].x + enemy3[i].width > WIDTH)
						{
							enemy3_direct1++;
						}
					}
				}

			}
			if (i == 2)//型号为2的飞机,奇数向左,偶数向右,且先向左
			{
				if (enemy3[i].y < HEIGHT / 2)//先移动到画面中
				{
					enemy3[i].y += 10;
				}
				else
				{
					if (enemy3_direct2 % 2 == 1)
					{
						enemy3[i].x -= 2;
						if (enemy3[i].x < 0)
						{
							enemy3_direct2++;
						}
					}
					if (enemy3_direct2 % 2 == 0)
					{
						enemy3[i].x += 2;
						if (enemy3[i].x + enemy3[i].width > WIDTH)
						{
							enemy3_direct2++;
						}
					}
				}
			}
			if (i == 3)//型号为3的飞机,奇数向右,偶数向左,且先向右边
			{
				if (enemy3[i].y < HEIGHT / 2)//先移动到画面中
				{
					enemy3[i].y += 10;
				}
				else
				{
					if (enemy3_direct3 % 2 == 0)
					{
						enemy3[i].x -= 2;
						if (enemy3[i].x < 0)
						{
							enemy3_direct3++;
						}
					}
					if (enemy3_direct3 % 2 == 1)
					{
						enemy3[i].x += 2;
						if (enemy3[i].x + enemy3[i].width > WIDTH)
						{
							enemy3_direct3++;
						}
					}
				}

			}
			if (i == 4)//型号为4的飞机,奇数向左,偶数向右,且先向左
			{
				if (enemy3[i].y < HEIGHT / 2)//先移动到画面中
				{
					enemy3[i].y += 10;
				}
				else
				{
					if (enemy3_direct4 % 2 == 1)
					{
						enemy3[i].x -= 2;
						if (enemy3[i].x < 0)
						{
							enemy3_direct4++;
						}
					}
					if (enemy3_direct4 % 2 == 0)
					{
						enemy3[i].x += 2;
						if (enemy3[i].x + enemy3[i].width > WIDTH)
						{
							enemy3_direct4++;
						}
					}
				}

			}
			if (enemy3[i].y < -3)
			{
				enemy3[i].isExit = false;
			}
		}
	}
	for (i = 0; i < 1; i++)
	{
		if (enemy4[i].isExit)
		{
			if (enemy4_direct0 % 2 == 1)//奇数向左,偶数向右且先向左
			{
				enemy4[i].x -= 1;
				if (enemy4[i].x < 0)
				{
					enemy4_direct0++;
				}
			}
			if (enemy4_direct0 % 2 == 0)
			{
				enemy4[i].x += 1;
				if (enemy4[i].x + enemy4[i].width > WIDTH)
				{
					enemy4_direct0++;
				}
			}
		}
	}
}
void EnemyClean()
{
	//主要用于产生BOSS前,将其他飞机和子弹清除
	int i;
	for (i = 0; i < 10; i++)//敌机1,遍历所有敌机位,若敌机存在则清除
	{
		if (enemy1[i].isExit == true)
		{
			enemy1[i].isExit = false;
		}
	}
	for (i = 0; i < 5; i++)//敌机2
	{
		if (enemy2[i].isExit == true)
		{
			enemy2[i].isExit = false;
		}
	}

	for (i = 0; i < 5; i++)//敌机3
	{
		if (enemy3[i].isExit == true)
		{
			enemy3[i].isExit = false;
		}
	}
	for (i = 0; i < enemy_bul_max; i++)//遍历所有子弹位,若子弹存在则清除
	{
		if (enemy2_bullet[i].isExit == true)
		{
			enemy2_bullet[i].isExit = false;

		}
		if (enemy3_bullet[i].isExit == true)
		{
			enemy3_bullet[i].isExit = false;

		}
		if (enemy4_bullet[i].isExit == true)
		{
			enemy4_bullet[i].isExit = false;
		}
	}
	for (i = 0; i < 1; i++)
	{
		if (lighter[i].isExit == true)
			lighter[i].isExit = false;
	}
}
void EnemyCreat_L1()
{
	int i, j;
	int count1 = 0, count2 = 0;
	if (Timer_enemycreat(5000))
	{
		if (level() == 1)
		{
			for (i = 0; i < 10; i++)//敌机1
			{
				if (enemy1[i].isExit == false)
				{
					enemy1[i].isExit = true;
					enemy1[i].x = rand() % (WIDTH - 60);
					enemy1[i].y = 0;
					enemy1[i].hp = 30;
					count1++;
					if (count1 == 2)//每个循环产生3次敌机
					{
						count1 = 0;
						break;
					}

				}
			}
			for (j = 0; j < 5; j++)//敌机2
			{
				if (enemy2[j].isExit == false)
				{
					enemy2[j].isExit = true;
					enemy2[j].hp = 50;
					enemy2[j].x = rand() % (WIDTH - 60);
					enemy2[j].y = 0;
					count2++;
					if (count2 == 1)//每个循环产生2次敌机
					{
						count2 = 0;
						break;
					}
				}
			}
			if (score > 2500)
			{
				for (j = 0; j < 5; j++)//敌机3
				{
					if (enemy3[j].isExit == false)
					{
						enemy3[j].isExit = true;
						enemy3[j].hp = 30;
						enemy3[j].x = rand() % (WIDTH - 60);
						enemy3[j].y = 0;
						break;//每个循环只产生1次敌机
					}
				}
			}
		}
	}
}
void EnemyCreat_L2()
{
	int i, j;
	if (Timer_enemycreat(3000))
	{
		if (level() == 2)
		{
			if (score > 5000 && score <= 8000)
			{
				for (i = 0; i < 10; i++)//敌机1
				{
					if (enemy1[i].isExit == false)
					{
						enemy1[i].isExit = true;
						enemy1[i].x = rand() % (WIDTH - 60);
						enemy1[i].y = 0;
						enemy1[i].hp = 30;
						break;
					}
				}
				for (j = 0; j < 5; j++)//敌机2
				{
					if (enemy2[j].isExit == false)
					{
						enemy2[j].isExit = true;
						enemy2[j].hp = 50;
						enemy2[j].x = rand() % (WIDTH - 60);
						enemy2[j].y = 0;
						break;
					}
				}
				for (j = 0; j < 5; j++)//敌机3
				{
					if (enemy3[j].isExit == false)
					{
						enemy3[j].isExit = true;
						enemy3[j].hp = 50;
						enemy3[j].x = -enemy3[j].width * 1.5;
						enemy3[j].y = 0;
						break;
					}
				}
			}
			if (score > 8000)
			{
				EnemyClean();//boss出现时清理其他的所有的飞机
				for (j = 0; j < 1; j++)
				{
					if (enemy4[j].isExit == false)
					{
						enemy4[j].isExit = true;
						enemy4[j].hp = 10000;
						enemy4[j].x = WIDTH / 2 - enemy4[j].width / 2;
						enemy4[j].y = 0;
						break;
					}
				}
			}

		}
	}
}
void EnemyCreat_L3()
{
	EnemyClean();
	int j;
	if (level() == 3)
	{
		if (score < 17000);
		{
			for (j = 0; j < 1; j++)
			{
				if (enemy5[j].isExit == false)
				{
					enemy5[j].isExit = true;
					enemy5[j].hp = 12000;
					enemy5[j].x = WIDTH / 2 - enemy5[j].width / 2;
					enemy5[j].y = 0;
					break;
				}
			}
		}
	}
}
void EnemyCreat_L4()
{
	int i, j;
	int count1 = 0, count2 = 0;
	if (Timer_enemycreat(3000))
	{
		if (level() == 5)
		{
			for (i = 0; i < 10; i++)//敌机1
			{
				if (enemy1[i].isExit == false)
				{
					enemy1[i].isExit = true;
					enemy1[i].x = rand() % (WIDTH - 60);
					enemy1[i].y = 0;
					enemy1[i].hp = 30;
					count1++;
					if (count1 == 2)//每个循环产生3次敌机
					{
						count1 = 0;
						break;
					}

				}
			}
			for (j = 0; j < 5; j++)//敌机2
			{
				if (enemy2[j].isExit == false)
				{
					enemy2[j].isExit = true;
					enemy2[j].hp = 50;
					enemy2[j].x = rand() % (WIDTH - 60);
					enemy2[j].y = 0;
					count2++;
					if (count2 == 1)//每个循环产生2次敌机
					{
						count2 = 0;
						break;
					}
				}
			}
			for (j = 0; j < 5; j++)//敌机3
			{
				if (enemy3[j].isExit == false)
				{
					enemy3[j].isExit = true;
					enemy3[j].hp = 50;
					enemy3[j].x = -enemy3[j].width * 1.5;
					enemy3[j].y = 0;
					break;
				}
			}
		}
	}
}
void Enemy_Bullet_Creat()
{
	int i, j;
	if (Timer_enemy2_bullet_creat(3000))//子弹发射频率
	{
		for (j = 0; j < 5; j++)
		{
			for (i = 0; i < enemy_bul_max; i++)
			{
				if (enemy2_bullet[i].isExit == false && enemy2[j].isExit == true)
				{
					enemy2_bullet[i].isExit = true;
					enemy2_bullet[i].x = enemy2[j].x + enemy2[j].width / 2.0 ;
					enemy2_bullet[i].y = enemy2[j].y;
					break;
				}
			}
		}
	}
	if (Timer_enemy3_bullet_creat(2000))
	{
		for (j = 0; j < 3; j++)
		{
			for (i = 0; i < enemy_bul_max; i++)
			{
				if (enemy3_bullet[i].isExit == false && enemy3[j].isExit == true)
				{
					enemy3_bullet[i].isExit = true;
					enemy3_bullet[i].x = enemy3[j].x + enemy3[j].width / 2.0;
					enemy3_bullet[i].y = enemy3[j].y;
					break;
				}
			}
		}
	}
	int count4 = 1;//boss两侧发射子弹
	if (Timer_enemy4_bullet_creat(100))
	{
		for (j = 0; j < 1; j++)
		{
			for (i = 0; i < enemy_bul_max; i++)
			{
				if (enemy4_bullet[i].isExit == false && enemy4[j].isExit == true)
				{
					enemy4_bullet[i].isExit = true;
					if (count4 == 1)//每次循环先左侧发射一次
					{
						enemy4_bullet[i].x = enemy4[j].x + 38;
						enemy4_bullet[i].y = enemy4[j].y + 37;
						count4 += 1;
						continue;
					}
					if (count4 == 2)//再右侧发射一次
					{
						count4 = 1;
						enemy4_bullet[i].x = enemy4[j].x + enemy4[j].width - 73;
						enemy4_bullet[i].y = enemy4[j].y + 37;
						break;
					}
				}
			}
		}
	}
	int count5 = 1;
	if (Timer_enemy5_bullet_creat(200))
	{
		for (j = 0; j < 1; j++)
		{
			for (i = 0; i < enemy_bul_max; i++)
			{
				if (enemy5_bullet[i].isExit == false && enemy5[j].isExit == true)
				{
					enemy5_bullet[i].isExit = true;
					if (count5 == 1)
					{
						enemy5_bullet[i].x = enemy5[j].x + 155;
						enemy5_bullet[i].y = enemy5[j].y + 360;
						count5 += 1;
						continue;
					}
					if (count5 == 2)
					{
						count5 = 1;
						enemy5_bullet[i].x = enemy5[j].x + enemy5[j].width - 175;
						enemy5_bullet[i].y = enemy5[j].y + 360;
						break;
					}
				}
			}
		}
	}
}
void Enemy_Bullet_Move()
{
	int i;
	//敌机2
	for (i = 0; i < enemy_bul_max; i++)
	{

		if (enemy2_bullet[i].isExit == true)
		{
			enemy2_bullet[i].y += rand() % 2 + 2;

			if (enemy2_bullet[i].y < 0)
			{
				enemy2_bullet[i].isExit = false;
			}
		}
	}
	//敌机3
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy3_bullet[i].isExit == true)
		{
			enemy3_bullet[i].y += rand() % 3 + 3;
			if (enemy3_bullet[i].y < 0)
			{
				enemy3_bullet[i].isExit = false;
			}
		}
	}

	//敌机4
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy4_bullet[i].isExit == true)
		{
			enemy4_bullet[i].y += 8;
			if (enemy4_bullet[i].y > HEIGHT)
			{
				enemy4_bullet[i].isExit = false;
			}
		}
	}
	//敌机5
	for (i = 0; i < enemy_bul_max; i++)
	{
		if (enemy5_bullet[i].isExit == true)
		{
			enemy5_bullet[i].y += 8;
			if (enemy5_bullet[i].y > HEIGHT)
			{
				enemy5_bullet[i].isExit = false;
			}
		}
	}
}
void Enemy_Bullet_Crush()
{
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)//如果我方飞机不存在,则跳出本次循环
			continue;
		for (int j = 0; j < enemy_bul_max; j++)
		{
			if (!enemy2_bullet[j].isExit)
				continue;
			if (enemy2_bullet[j].x > myplane[i].x && enemy2_bullet[j].x < myplane[i].x + myplane[i].width && enemy2_bullet[j].y < myplane[i].y + myplane[i].height && enemy2_bullet[j].y > myplane[i].y)
			{
				myplane[i].hp -= 10;
				setbkmode(TRANSPARENT);//如果飞机扣血,则输出扣血量
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(myplane[i].x, myplane[i].y + rand() % (myplane[i].height), _T("-10"));
				}
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)
			continue;
		for (int j = 0; j < enemy_bul_max; j++)
		{
			if (!enemy3_bullet[j].isExit)
				continue;
			if (enemy3_bullet[j].x > myplane[i].x && enemy3_bullet[j].x < myplane[i].x + myplane[i].width && enemy3_bullet[j].y < myplane[i].y + myplane[i].height && enemy3_bullet[j].y > myplane[i].y)
			{
				myplane[i].hp -= 10;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(myplane[i].x, myplane[i].y + rand() % (myplane[i].height), _T("-10"));
				}
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)
			continue;
		for (int j = 0; j < enemy_bul_max; j++)
		{
			if (!enemy4_bullet[j].isExit)
				continue;
			if (enemy4_bullet[j].x > myplane[i].x && enemy4_bullet[j].x < myplane[i].x + myplane[i].width && enemy4_bullet[j].y < myplane[i].y + myplane[i].height && enemy4_bullet[j].y > myplane[i].y)
			{
				myplane[i].hp -= 10;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(myplane[i].x, myplane[i].y + rand() % (myplane[i].height), _T("-10"));
				}
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)
			continue;
		for (int j = 0; j < enemy_bul_max; j++)
		{
			if (!enemy5_bullet[j].isExit)
				continue;
			if (enemy5_bullet[j].x > myplane[i].x && enemy5_bullet[j].x < myplane[i].x + myplane[i].width && enemy5_bullet[j].y < myplane[i].y + myplane[i].height && enemy5_bullet[j].y > myplane[i].y)
			{
				myplane[i].hp -= 10;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(myplane[i].x, myplane[i].y + rand() % (myplane[i].height), _T("-10"));
				}
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
}
void EnemyCrush()
{
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)
			continue;
		for (int j = 0; j < 10; j++)
		{
			if (!enemy1[j].isExit)
				continue;
			if (enemy1[j].x > myplane[i].x && enemy1[j].x < myplane[i].x + myplane[i].width && enemy1[j].y > myplane[i].y && enemy1[j].y < myplane[i].y + myplane[i].height)
			{
				myplane[i].hp -= 100;
				enemy1[j].isExit = false;
				score += rand() % 10 + 20;
				enemy1[j].hp = 30;
				CreateThread(0, 0, Boom, 0, 0, 0);
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)
			continue;
		for (int j = 0; j < 5; j++)
		{
			if (!enemy2[j].isExit)
				continue;
			if (enemy2[j].x > myplane[i].x && enemy2[j].x<myplane[i].x + myplane[i].width && enemy2[j].y>myplane[i].y && enemy2[j].y < myplane[i].y + myplane[i].height)
			{
				myplane[i].hp -= 100;
				enemy2[j].isExit = false;
				score += rand() % 50 + 100;
				enemy2[j].hp = 50;
				CreateThread(0, 0, Boom, 0, 0, 0);
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
	for (int i = 0; i < 1; i++)
	{
		if (!myplane[i].isExit)
			continue;
		for (int j = 0; j < 5; j++)
		{
			if (!enemy3[j].isExit)
				continue;
			if (enemy3[j].x > myplane[i].x && enemy3[j].x<myplane[i].x + myplane[i].width && enemy3[j].y>myplane[i].y && enemy3[j].y < myplane[i].y + myplane[i].height)
			{
				myplane[i].hp -= 100;
				enemy3[j].isExit = false;
				score += rand() % 50 + 100;
				enemy3[j].hp = 30;
				CreateThread(0, 0, Boom, 0, 0, 0);
			}
			if (myplane[i].hp <= 0)
			{
				Judge();
			}
		}
	}
}
void UpdatePlane()
{
	//GetAsyncKeyState非阻塞获取键盘信息函数
	//飞机移动
	if (GetAsyncKeyState(VK_UP))                //按UP键
	{
		for (int i = 0; i < 1; i++)
		{
			if (myplane[i].y > 0)//如果没有超过边界再执行
			{
				myplane[i].y -= 8;
				//加载飞机移动音乐
				mciSendString(L"open 飞机移动.mp3", 0, 0, 0);
				mciSendString(L"play 飞机移动.mp3", 0, 0, 0);
			}
		}
	}
	if (GetAsyncKeyState(VK_DOWN))              //按DOWN键
	{
		for (int i = 0; i < 1; i++)
		{
			if (myplane[i].y < HEIGHT - myplane[i].height)
			{
				myplane[i].y += 8;
				//加载飞机移动音乐
				mciSendString(L"open 飞机移动.mp3", 0, 0, 0);
				mciSendString(L"play 飞机移动.mp3", 0, 0, 0);
			}
		}
	}
	if (GetAsyncKeyState(VK_LEFT))              //按LEFT键
	{
		for (int i = 0; i < 1; i++)
		{
			if (myplane[i].x > -(myplane[i].width) / 2)
			{
				myplane[i].x -= 8;
				//加载飞机移动音乐
				mciSendString(L"open 飞机移动.mp3", 0, 0, 0);
				mciSendString(L"play 飞机移动.mp3", 0, 0, 0);
			}
		}
	}
	if (GetAsyncKeyState(VK_RIGHT))              //按RIGHT键
	{
		for (int i = 0; i < 1; i++)
		{
			if (myplane[i].x < WIDTH - (myplane[i].width) / 2)
			{
				myplane[i].x += 8;
				//加载飞机移动音乐
				mciSendString(L"open 飞机移动.mp3", 0, 0, 0);
				mciSendString(L"play 飞机移动.mp3", 0, 0, 0);
			}
		}
	}
	if (GetAsyncKeyState('J') || GetAsyncKeyState('j'))
	{
		CreateThread(0, 0, PlaneFireMusic, 0, 0, 0);
		DrawBullet();
	}
	if (GetAsyncKeyState('L') || GetAsyncKeyState('l'))
	{
		if (Timer1(30000))
		{
			CreateThread(0, 0, PlaneLighterMusic, 0, 0, 0);
			DrawLighter();
		}
	}
}
void initGame()
{
	int i;
	//初始化背景地图Y轴坐标(为了后续移动背景地图)
	bky0 = -HEIGHT;
	bky1 = 0;
	bk1y0 = -HEIGHT;
	bk1y1 = 0;
	bk2y0 = -HEIGHT;
	bk2y1 = 0;
	bk3y0 = -HEIGHT;
	bk3y1 = 0;
	//初始化我方飞机
	for (i = 0; i < 1; i++)
	{
		myplane[i].x = (WIDTH - myplane[i].width) / 2;
		myplane[i].y = (HEIGHT - myplane[i].height);
		myplane[i].hp = 500;
		myplane[i].isExit = true;
	}
	//初始化敌机
	for (i = 0; i < 10; i++)
	{
		enemy1[i].isExit = false;
		enemy1[i].hp = 30;
		enemy1[i].width = 70;
		enemy1[i].height = 70;
	}
	for (i = 0; i < 5; i++)
	{
		enemy2[i].isExit = false;
		enemy2[i].hp = 50;
		enemy2[i].width = 85;
		enemy2[i].height = 90;
	}
	for (i = 0; i < 5; i++)
	{
		enemy3[i].isExit = false;
		enemy3[i].hp = 30;
		enemy3[i].width = 70;
		enemy3[i].height = 70;
	}
	for (i = 0; i < 1; i++)
	{
		enemy4[i].isExit = false;
		enemy4[i].hp = 10000;
		enemy4[i].width = 450;
		enemy4[i].height = 300;
	}
	for (i = 0; i < 1; i++)
	{
		enemy5[i].isExit = false;
		enemy5[i].hp = 12000;
		enemy5[i].width = 500;
		enemy5[i].height = 375;
	}
	//初始化子弹
	bullet[i].x1; bullet[i].y1; bullet[i].x2; bullet[i].y2;
	for (i = 0; i < bullet_max; i++)
	{
		bullet[i].isExit = false;
	}
	//初始化敌机子弹
	for (i = 0; i < enemy_bul_max; i++)
	{   
		enemy2_bullet[i].isExit = false;
	}
	for (i = 0; i < enemy_bul_max; i++)
	{   
		enemy3_bullet[i].isExit = false;
	}

	for (i = 0; i < enemy_bul_max; i++)
	{   
		enemy4_bullet[i].isExit = false;
	}
	for (i = 0; i < enemy_bul_max; i++)
	{   
		enemy5_bullet[i].isExit = false;
	}
	for (i = 0; i < 1; i++)
	{
		lighter[i].isExit = false;
	}
	//加载背景音乐
	music.isExit = true;
	if (music.isExit == true)
	{
		mciSendString(L"open level.mp3", 0, 0, 0);
		mciSendString(L"play level.mp3 repeat", 0, 0, 0);
	}
}
void level_change()
{
	int ret = level(),i = 0;
	if (flag == 1)
	{
		if (level_change_count == 1 && score > 5000)
		{
			level_change_count += 1;
			myplane[i].hp = 500;
			EnemyClean();//切换关卡时清除所有飞机
		}
		if (level_change_count == 2 && score > 12000)
		{
			score = 12001;
			level_change_count += 1;
			myplane[i].hp = 500;
			EnemyClean();
		}
	}
}
void FailMenu()
{
		initgraph(800, 240);
		setbkmode(TRANSPARENT);
		settextstyle(30, 0, L"宋体");
		outtextxy(10, 20, _T("游戏失败"));
		outtextxy(10, 70, _T("按Delete键退出"));
		outtextxy(10, 120, _T("按Enter(回车键)复活并继续游戏"));
		while (1)
		{
			if (GetAsyncKeyState(VK_DELETE)) exit(0);//如果按下DELETE键则直接结束程序
			if (GetAsyncKeyState(VK_RETURN)) //如果按下回车键则继续游戏
			{
				break;
			}
		}
		main();
}
void PauseMenu()
{
	if (GetAsyncKeyState(VK_SPACE))
	{
		if (flag == 1)
		{
			menuState = Pause;
			flag1 = 1;
			flag = 0;
		}
		else if (flag == 2)
		{
			menuState = Pause;
			flag1 = 2;
			flag = 0;
		}
	}
}
void Judge()
{
	if (flag == 1)
	{
		if (myplane->hp <= 0)
		{
			if (level() == 1)
			{
				score = 0;//第一关初始分数为0
			}
			if (level() == 2 && score < 8000)
			{
				score = 5001;//进入第二关,且第二关boss出现前,初始分数为5001
			}
			if (level() == 2 && score > 8000)
			{
				score = 8001;//第二关boss出现后,初始分数
			}
			if (level() == 3)
			{
				score = 12001;//进入第三关,初始分数
			}
			FailMenu();
		}
		if (score > 17000)
		{
			EndMenu();
		}
	}
}
void UpdateBack()
{
	//背景移动
	bky0++;    
	bky1++;
	if (bky0 > HEIGHT)
		(bky0 = -HEIGHT);                       //如果背景移出初始界面,则放到下面
	if (bky1 > HEIGHT)
		(bky1 = -HEIGHT);
	bk1y0++;
	bk1y1++;
	if (bk1y0 > HEIGHT)
		(bk1y0 = -HEIGHT);                       //如果背景移出初始界面,则放到下面
	if (bk1y1 > HEIGHT)
		(bk1y1 = -HEIGHT);
	bk2y0++;
	bk2y1++;
	if (bk2y0 > HEIGHT)
		(bk2y0 = -HEIGHT);                       //如果背景移出初始界面,则放到下面
	if (bk2y1 > HEIGHT)
		(bk2y1 = -HEIGHT);
	bk3y0++;
	bk3y1++;
	if (bk3y0 > HEIGHT)
		(bk3y0 = -HEIGHT);                       //如果背景移出初始界面,则放到下面
	if (bk3y1 > HEIGHT)
		(bk3y1 = -HEIGHT);
}
void DrawBullet()
{
	if (Timer(140))
	{
		//绘制子弹
		for (int i = 0; i < bullet_max; i++)
		{
			if (!bullet[i].isExit)                  //遍历所有子弹位,找到一个空位存放子弹
			{
				bullet[i].x1 = myplane->x + 18;   //若子弹存在初始化子弹坐标
				bullet[i].y1 = myplane->y + 25;
				bullet[i].x2 = myplane->x + 65;
				bullet[i].y2 = myplane->y + 25;
				bullet[i].isExit = true;
				break;                              //发射一次子弹
			}
		}
	}
}
void DrawLighter()
{
	for (int i = 0; i < 1; i++)
	{
		if (!lighter[i].isExit)
		{
			lighter[i].x = myplane->x - (305 - myplane->width) / 2;
			lighter[i].y = myplane->y - 200;
			lighter[i].isExit = true;
			break;
		}
	}
}
void MoveBullet()
{
	//子弹移动
	for (int i = 0; i < bullet_max; i++)
	{
		if (bullet[i].isExit)
		{
			bullet[i].y1 -= 10;
			bullet[i].y2 -= 10;
			if (bullet[i].y1 > HEIGHT || bullet[i].y2 > HEIGHT )
				bullet[i].isExit = false;  //若子弹飞出则腾出一个子弹位 
		}
	}
}
void MoveLighter()
{
	for (int i = 0; i < 1; i++)
	{
		if (lighter[i].isExit)
		{
			lighter[i].y -= 5;
			if (lighter[i].y < -200)
				lighter[i].isExit = false;
		}
	}
}
void Bulletcrush()
{
	for (int i = 0; i < 10; i++)
	{
		if (!enemy1[i].isExit)
			continue;
		for (int j = 0; j < bullet_max; j++)
		{
			if (!bullet[j].isExit)
				continue;
			if ((bullet[j].x1 > enemy1[i].x && bullet[j].x1<enemy1[i].x + enemy1[i].width && bullet[j].y1>enemy1[i].y && bullet[j].y1 < enemy1[i].y + enemy1[i].height) || (bullet[j].x2>enemy1[i].x && bullet[j].x2<enemy1[i].x + enemy1[i].width
				&& bullet[j].y2>enemy1[i].y && bullet[j].y2 < enemy1[i].y + enemy1[i].height))
			{
				enemy1[i].hp -= 1;
				if (Timer2(1))
				{
					setbkmode(TRANSPARENT);
					settextstyle(60, 0, L"华文行楷");
					outtextxy(enemy1[i].x, enemy1[i].y + rand() % (enemy1[i].height), _T("-1"));
				}
			}
		}
		if (enemy1[i].hp <= 0)
		{
			enemy1[i].isExit = false;
			CreateThread(0, 0, Boom, 0, 0, 0);
			score += rand() % 10 + 20;
			enemy1[i].hp = 30;
		}
	}//小飞机
	for (int i = 0; i < 5; i++)
	{
		if (!enemy2[i].isExit)
			continue;
		for (int j = 0; j < bullet_max; j++)
		{
			if (!bullet[j].isExit)
				continue;
			if ((bullet[j].x1 > enemy2[i].x && bullet[j].x1<enemy2[i].x + enemy2[i].width && bullet[j].y1>enemy2[i].y && bullet[j].y1 < enemy2[i].y + enemy2[i].height) || (bullet[j].x2>enemy2[i].x && bullet[j].x2<enemy2[i].x + enemy2[i].width && bullet[j].y2>enemy2[i].y && bullet[j].y2 < enemy2[i].y + enemy2[i].height))
			{
				enemy2[i].hp -= 1;
				if (Timer2(1))
				{
					setbkmode(TRANSPARENT);
					settextstyle(60, 0, L"华文行楷");
					outtextxy(enemy2[i].x, enemy2[i].y + rand() % (enemy2[i].height), _T("-1"));
				}
			}
		}
		if (enemy2[i].hp <= 0)
		{
			enemy2[i].isExit = false;
			CreateThread(0, 0, Boom, 0, 0, 0);
			score += rand() % 50 + 100;
			enemy2[i].hp = 50;
		}
	}//中飞机
	for (int i = 0; i < 5; i++)
	{
		if (!enemy3[i].isExit)
			continue;
		for (int j = 0; j < bullet_max; j++)
		{
			if (!bullet[j].isExit)
				continue;
			if ((bullet[j].x1 > enemy3[i].x && bullet[j].x1<enemy3[i].x + enemy3[i].width && bullet[j].y1>enemy3[i].y && bullet[j].y1 < enemy3[i].y + enemy3[i].height) || (bullet[j].x2>enemy3[i].x && bullet[j].x2<enemy3[i].x + enemy3[i].width && bullet[j].y2>enemy3[i].y && bullet[j].y2 < enemy3[i].y + enemy3[i].height))
			{
				enemy3[i].hp -= 1;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(enemy3[i].x, enemy3[i].y + rand() % (enemy3[i].height), _T("-1"));
				}
			}
		}
		if (enemy3[i].hp <= 0)
		{
			enemy3[i].isExit = false;
			CreateThread(0, 0, Boom, 0, 0, 0);
			score += rand() % 50 + 100;
			enemy3[i].hp = 30;
		}
	}//横行飞机
	for (int i = 0; i < 1; i++)
	{
		if (!enemy4[i].isExit)
			continue;
			for (int j = 0; j < bullet_max; j++)
			{
				if(!bullet[j].isExit)
					continue;
				if ((bullet[j].x1 > enemy4[i].x && bullet[j].x1<enemy4[i].x + enemy4[i].width && bullet[j].y1>enemy4[i].y && bullet[j].y1 < enemy4[i].y + enemy4[i].height) || (bullet[j].x2 > enemy4[i].x && bullet[j].x2<enemy4[i].x + enemy4[i].width && bullet[j].y2>enemy4[i].y && bullet[j].y2 < enemy4[i].y + enemy4[i].height))
				{
					enemy4[i].hp -= rand() % 4 + 1;
					setbkmode(TRANSPARENT);
					settextstyle(60, 0, L"华文行楷");
					if (Timer2(1))
					{
						if (enemy4[i].hp -= 1)
						{
							outtextxy(enemy4[i].x + rand() % (enemy4[i].width), enemy4[i].y + rand() % (enemy4[i].height), _T("-1"));
						}
						if (enemy4[i].hp -= 2)
						{
							outtextxy(enemy4[i].x + rand() % (enemy4[i].width), enemy4[i].y + rand() % (enemy4[i].height), _T("-2"));
						}
						if (enemy4[i].hp -= 3)
						{
							outtextxy(enemy4[i].x + rand() % (enemy4[i].width), enemy4[i].y + rand() % (enemy4[i].height), _T("-3"));
						}
						if (enemy4[i].hp -= 4)
						{
							outtextxy(enemy4[i].x + rand() % (enemy4[i].width), enemy4[i].y + rand() % (enemy4[i].height), _T("暴击 -4"));
						}
						if (enemy4[i].hp -= 5)
						{
							outtextxy(enemy4[i].x + rand() % (enemy4[i].width), enemy4[i].y + rand() % (enemy4[i].height), _T("暴击 -5"));
						}
					}
				}
				if (enemy4[i].hp <= 0)
				{
					enemy4[i].isExit = false;
					CreateThread(0, 0, Boom, 0, 0, 0);
					score += 4000;
				}
			}
	}
	//第二关BOSS
	for (int i = 0; i < 1; i++)
	{
		if (!enemy5[i].isExit)
			continue;
		for (int j = 0; j < bullet_max; j++)
		{
			if (!bullet[j].isExit)
				continue;
			if ((bullet[j].x1 > enemy5[i].x && bullet[j].x1<enemy5[i].x + enemy5[i].width && bullet[j].y1>enemy5[i].y && bullet[j].y1 < enemy5[i].y + enemy5[i].height && bullet[j].x2>enemy5[i].x) || (bullet[j].x2<enemy5[i].x + enemy5[i].width && bullet[j].y2>enemy5[i].y && bullet[j].y2 < enemy5[i].y + enemy5[i].height))
			{
				enemy5[i].hp -= rand() % 5 + 1;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					if (enemy5[i].hp -= 1)
					{
						outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("-1"));
					}
					if (enemy5[i].hp -= 2)
					{
						outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("-2"));
					}
					if (enemy5[i].hp -= 3)
					{
						outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("-3"));
					}
					if (enemy5[i].hp -= 4)
					{
						outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("暴击 -4"));
					}
					if (enemy5[i].hp -= 5)
					{
						outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("暴击 -5"));
					}
					if (enemy5[i].hp -= 6)
					{
						outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("暴击 -6"));
					}
				}
			}
			if (enemy5[i].hp <= 0)
			{
				enemy5[i].isExit = false;
				CreateThread(0, 0, Boom, 0, 0, 0);
				score += 5000;
				Judge();
			}
		}
	}
	//第三关BOSS
}
void LighterCrush()
{
	for (int j = 0; j < 1; j++)
	{
		if (!lighter[j].isExit)
			continue;
		for (int i = 0; i < 10; i++)
		{
			if (!enemy1[i].isExit)
				continue;
			if (enemy1[i].x > lighter[j].x - 20 && enemy1[i].x < lighter[j].x + 305 && enemy1[i].y > lighter[j].y && enemy1[i].y < lighter[j].y + 200)
			{
				enemy1[i].hp -= 100;
				if (Timer2(1))
				{
					setbkmode(TRANSPARENT);
					settextstyle(60, 0, L"华文行楷");
					outtextxy(enemy1[i].x, enemy1[i].y + rand() % (enemy1[i].height), _T("-100"));
				}
			}
		}
		if (enemy1[j].hp <= 0)
		{
			enemy1[j].isExit = false;
			CreateThread(0, 0, Boom, 0, 0, 0);
			score += rand() % 10 + 20;
			enemy1[j].hp = 30;
		}
	}//小飞机
	for (int j = 0; j < 1; j++)
	{
		if (!lighter[j].isExit)
			continue;
		for (int i = 0; i < 5; i++)
		{
			if (!enemy2[i].isExit)
				continue;
			if (enemy2[i].x > lighter[j].x - 20 && enemy2[i].x < lighter[j].x + 305 && enemy2[i].y > lighter[j].y && enemy2[i].y < lighter[j].y + 200)
			{
				enemy2[i].hp -= 100;
				if (Timer2(1))
				{
					setbkmode(TRANSPARENT);
					settextstyle(60, 0, L"华文行楷");
					outtextxy(enemy2[i].x, enemy2[i].y + rand() % (enemy2[i].height), _T("-100"));
				}
			}
		}
		if (enemy2[j].hp <= 0)
		{
			enemy2[j].isExit = false;
			CreateThread(0, 0, Boom, 0, 0, 0);
			score += rand() % 50 + 100;
			enemy2[j].hp = 50;
		}
	}//大飞机
	for (int j = 0; j < 1; j++)
	{
		if (!lighter[j].isExit)
			continue;
		for (int i = 0; i < 5; i++)
		{
			if (!enemy3[i].isExit)
				continue;
			if (enemy3[i].x > lighter[j].x - 20 && enemy3[i].x < lighter[j].x + 305 && enemy3[i].y > lighter[j].y && enemy3[i].y < lighter[j].y + 200)
			{
				enemy3[i].hp -= 100;
				if (Timer2(1))
				{
					setbkmode(TRANSPARENT);
					settextstyle(60, 0, L"华文行楷");
					outtextxy(enemy3[i].x, enemy3[i].y + rand() % (enemy3[i].height), _T("-100"));
				}
			}
		}
		if (enemy3[j].hp <= 0)
		{
			enemy3[j].isExit = false;
			CreateThread(0, 0, Boom, 0, 0, 0);
			score += rand() % 50 + 100;
			enemy3[j].hp = 30;
		}
	}//横行飞机
	for (int i = 0; i < 1; i++)
	{
		if (!enemy4[i].isExit)
			continue;
		for (int j = 0; j < 1; j++)
		{
			if (!lighter[j].isExit)
				continue;
			if ((lighter[j].x > enemy4[i].x && lighter[j].x < enemy4[i].x + enemy4[i].width && lighter[j].y > enemy4[i].y && lighter[j].y < enemy4[i].y + enemy4[i].height) ||
				(lighter[j].x + 305 > enemy4[i].x && lighter[j].x + 305 < enemy4[i].x + enemy4[i].width && lighter[j].y > enemy4[i].y && lighter[j].y < enemy4[i].y + enemy4[i].height) ||
				lighter[j].x > enemy4[i].x && lighter[j].x < enemy4[i].x + enemy4[i].width && lighter[j].y + 200 > enemy4[i].y && lighter[j].y + 200 < enemy4[i].y + enemy4[i].height ||
				lighter[j].x + 305 > enemy4[i].x && lighter[j].x + 305 < enemy4[i].x + enemy4[i].width && lighter[j].y + 200 > enemy4[i].y && lighter[j].y + 200 < enemy4[i].y + enemy4[i].height)
			{
				enemy4[i].hp -= 100;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(enemy4[i].x + rand() % (enemy4[i].width), enemy4[i].y + rand() % (enemy4[i].height), _T("-100"));
				}
			}
			if (enemy4[i].hp <= 0)
			{
				enemy4[i].isExit = false;
				CreateThread(0, 0, Boom, 0, 0, 0);
				score += 4000;
			}
		}
	}
	//第二关BOSS
	for (int i = 0; i < 1; i++)
	{
		if (!enemy5[i].isExit)
			continue;
		for (int j = 0; j < 1; j++)
		{
			if (!lighter[j].isExit)
				continue;
			if ((lighter[j].x > enemy5[i].x && lighter[j].x < enemy5[i].x + enemy5[i].width && lighter[j].y > enemy5[i].y && lighter[j].y < enemy5[i].y + enemy5[i].height) ||
				(lighter[j].x + 305 > enemy5[i].x && lighter[j].x + 305 < enemy5[i].x + enemy5[i].width && lighter[j].y > enemy5[i].y && lighter[j].y < enemy5[i].y + enemy5[i].height) ||
				lighter[j].x > enemy5[i].x && lighter[j].x < enemy5[i].x + enemy5[i].width && lighter[j].y + 200 > enemy5[i].y && lighter[j].y + 200 < enemy5[i].y + enemy5[i].height ||
				lighter[j].x + 305 > enemy5[i].x && lighter[j].x + 305 < enemy5[i].x + enemy5[i].width && lighter[j].y + 200 > enemy5[i].y && lighter[j].y + 200 < enemy5[i].y + enemy5[i].height)
			{
				enemy5[i].hp -= 100;
				setbkmode(TRANSPARENT);
				settextstyle(60, 0, L"华文行楷");
				if (Timer2(1))
				{
					outtextxy(enemy5[i].x + rand() % (enemy5[i].width), enemy5[i].y + rand() % (enemy5[i].height), _T("-100"));
				}
			}
			if (enemy5[i].hp <= 0)
			{
				enemy5[i].isExit = false;
				CreateThread(0, 0, Boom, 0, 0, 0);
				score += 5000;
				Judge();
			}
		}
	}
}
void Print()
{
	setbkmode(TRANSPARENT);
	settextstyle(40, 0, L"华文行楷");
	TCHAR ScorePrint[100];
	_stprintf(ScorePrint, L"当前分数:%d", score);
	outtextxy(0, 750, ScorePrint);
	setbkmode(TRANSPARENT);
	settextstyle(40, 0, L"华文行楷");
	TCHAR HPPrint[100];
	_stprintf(HPPrint, L"当前血量:%d", myplane->hp);
	outtextxy(0, 800,HPPrint);
}
void ChallengeMode()
{
	if (flag == 2)
	{
		int i, j;
		for (i = 0; i < 1; i++)
		{
			if (lighter[i].isExit == true)
				lighter[i].isExit = false;
		}
		for (i = 0; i < 1; i++)
		{
			if (!myplane[i].isExit)
				continue;
			for (j = 0; j < 10; j++)
			{
				if (enemy1[j].y > HEIGHT)
					myplane[i].hp -= 100;
			}
		}
		for (i = 0; i < 1; i++)
		{
			if (!myplane[i].isExit)
				continue;
			for (j = 0; j < 5; j++)
			{
				if (enemy2[j].y > HEIGHT)
					myplane[i].hp -= 100;
			}
		}
		for (i = 0; i < 1; i++)
		{
			if (!myplane[i].isExit)
				continue;
			for (j = 0; j < 5; j++)
			{
				if (enemy3[j].y > HEIGHT)
					myplane[i].hp -= 100;
			}
		}
	}
}
void EndMenu()
{
	EnemyClean();
	if (flag == 1 && enemy5[0].isExit == false)
	{
		menuState = End2;
		flag = 0;
	}
}
void EndScene()
{
	if (flag == 2 && myplane->hp <= 0)
	{
		menuState = End;
		flag = 0;
	}
}
#include "雷霆飞机.h"
#include <conio.h>
#include <stdio.h>
#include <graphics.h>
#include <windows.h>
#include <conio.h>
#include<mmsystem.h>
#pragma comment(lib,"Winmm.lib")
#define WIDTH 600
#define HEIGHT 850
#define bullet_max 5000//屏幕上同时出现的子弹上限、
#define enemy_bul_max 1500  //敌方飞机子弹最大量
//将所有封装函数放入主函数进行调用
int main()
{
	HWND hwnd = initgraph(WIDTH, HEIGHT);
	SetWindowText(hwnd, L"雷霆战机");
	initGame();
	loadimg();
	BeginBatchDraw();//双缓冲绘图
	while (1)
	{
		while (level() == 0)
		{
			ExMessage msg;
			while (peekmessage(&msg, EX_MOUSE))
			{
				DrawInterface(&msg);
			}
			FlushBatchDraw();
		}
		UpdateBack();
		level_change();
		if (level() == 1)
		{
			EnemyCreat_L1();
		}
		if (level() == 2)
		{
			EnemyCreat_L2();
		}
		if (level() == 3)
		{
			EnemyCreat_L3();
		}
		if (level() == 5)
		{
			EnemyCreat_L4();
			ChallengeMode();
			EndScene();
		}
		PauseMenu();
		EnemyMove();
		Enemy_Bullet_Creat();
		Enemy_Bullet_Move();
		DrawGame();
		UpdatePlane();
		MoveBullet();
		MoveLighter();
		Bulletcrush();
		LighterCrush();
		Enemy_Bullet_Crush();
		EnemyCrush();
		Print();
		FlushBatchDraw();
		Sleep(1);
	}
	EndBatchDraw();
	return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/263015.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Instagram账号被封?必须了解的原因与防封技巧

您是否曾因 Instagram 帐户被暂停封禁而感到沮丧&#xff1f;这是一个常见问题&#xff0c;了解您的帐户被暂停的原因以及如何恢复帐户至关重要。 在本文中&#xff0c;我们将深入探讨 Instagram 帐户被封停的常见原因&#xff0c;并探讨重新获得访问权限的步骤。这个方法对于管…

源码订货系统的优势

源码订货系统是一种企业购买后可以获得源代码的订货系统&#xff0c;它可以不受软件厂商的规模、发展而修改和使用。与SaaS订货系统相比&#xff0c;核货宝为您分享源码订货系统的四大优势&#xff1a; 一是开放性&#xff1a;源码订货系统是开源的&#xff0c;用户可以掌握源代…

数据结构---算法的时间复杂度

文章目录 前言计算机重要存储数据结构与算法数据结构概念算法 数据库概念 算法的复杂度时间复杂度概念为什么有时间复杂度大O渐进表示法时间复杂度实例实例1&#xff1a;时间复杂度&#xff1a;O&#xff08;N&#xff09;实例2&#xff1a;这里输入参数是不确定的所以 时间复杂…

期货开平规则(期货交易开平规则解析)

什么是期货开平规则 期货开平规则&#xff0c;简单来说是指期货交易中的开仓和平仓所遵循的一系列规定。具体而言&#xff0c;开仓是指买入或卖出期货合约&#xff0c;建立一个新的持仓&#xff1b;平仓则是指买入或卖出相应数量的期货合约&#xff0c;用以解除原有持仓。开平…

MapReduce编程:Join应用

1. Reduce Join Map 端的主要工作&#xff1a;为来自不同表或文件的 key/value 对&#xff0c;打标签以区别不同来源的记录。然后用连接字段作为key &#xff0c;其余部分和新加的标志作为 value &#xff0c;最后进行输出。 Reduce 端的主要工作&#xff1a;在 Reduce 端…

解决IDEA编译/启动报错:Abnormal build process termination

报错信息 报错信息如下&#xff1a; Abnormal build process termination: "D:\Software\Java\jdk\bin\java" -Xmx3048m -Djava.awt.headlesstrue -Djava.endorsed.dirs\"\" -Djdt.compiler.useSingleThreadtrue -Dpreload.project.path………………很纳…

Mybatis之增删改查

一、引言 书接上回&#xff0c;我们在了解完mybatis之后&#xff0c;肯定要知道怎么使用&#xff0c;本文就来详细讲解Mybatis的增删改查事务&#xff0c;还不了解怎么配置mybatis的童鞋可以去这篇文章了解一下通俗易懂讲解javaweb之mybatis-CSDN博客 二、Mybatis——增 举例…

RK3568驱动指南|第八篇 设备树插件-第77章 注册group容器实验

瑞芯微RK3568芯片是一款定位中高端的通用型SOC&#xff0c;采用22nm制程工艺&#xff0c;搭载一颗四核Cortex-A55处理器和Mali G52 2EE 图形处理器。RK3568 支持4K 解码和 1080P 编码&#xff0c;支持SATA/PCIE/USB3.0 外围接口。RK3568内置独立NPU&#xff0c;可用于轻量级人工…

高校/企业如何去做数据挖掘呢?

随着近年来人工智能及大数据、云计算进入爆发时期&#xff0c;依托三者进行的数据分析、数据挖掘服务已逐渐成为各行业进行产业升级的载体&#xff0c;缓慢渗透进我们的工作和生活&#xff0c;成为新时代升级版的智能“大案牍术”。 那么对于多数企业来说&#xff0c;如何做数据…

MyBatis:动态 SQL 标签

MyBatis 动态 SQL 标签if 标签where 标签trim 标签choose 、when 、otherwise 标签foreach 标签附 动态 SQL 标签 MyBatis 动态 SQL 标签&#xff0c;是一组预定义的标签&#xff0c;用于构建动态的 SQL 语句&#xff0c;允许在 SQL 语句中使用条件、循环和迭代等逻辑。通过使…

Java代码审计Mybatis注入文件上传下载读取(非常详细!!)

目录 0x00 前言 0x01 Mybatis注入审计 - 若依&#xff08;Ruoyi&#xff09;后台管理系统 4.6.0 1、项目介绍与部署 - Ruoyi 2、若依 Ruoyi - Mybatis注入 - 代码审计 3、代审常搜词 - Java SQL 注入 0x02 文件上传漏洞审计 - Inxedu && Tmall 1、项目介绍与部署…

UE4移动端最小包优化实践

移动端对于包大小有着严苛的要求,然而UE哪怕是一个空工程打出来也有90+M,本文以一个复杂的工程为例,探索怎么把包大小降低到最小。 一、工程简介 工程包含代码、插件、资源、iOS原生库工程。 二、按官方文档进行基础优化 官方文档 1、勾选Use Pak File和Create comp…

linux buffer的回写的触发链路

mark_buffer_dirty中除了会标记dirty到buffer_head->state、page.flag、folio->mapping->i_pages外&#xff0c;还会调用inode所在文件系统的dirty方法&#xff08;inode->i_sb->s_op->dirty_inode&#xff09;。然后为inode创建一个它所在memory group的wri…

Moonbeam生态项目分析 — — 游戏项目The Great Escape

概览 The Great Escape是一款2D的Play and Earn平台游戏&#xff0c;曾入选MoonbeamMoonbeam Accelerator&#xff0c;并经此培训孵化后于2023年7月正式发表。 玩家必须在给定时间内在充满敌人和陷阱的关卡中收集尽可能多的水果。游戏结束后&#xff0c;游戏主要根据收集的水…

SpringSecurity深度解析与实践(2)

目录 引言1.Springboot结合SpringSecurity用户认证流程1.1 配置pom文件1.2.配置application.yml 2.自定义MD5加密3.BCryptPasswordEncoder密码编码器4.RememberMe记住我的实现5.CSRF防御5.1.什么是CSRF 引言 上篇网址 1.Springboot结合SpringSecurity用户认证流程 1.1 配置p…

大开关与计算机技术

大开关与计算机技术 一、引言 随着科技的飞速发展&#xff0c;计算机技术已经成为了我们生活中不可或缺的一部分。在这个信息化的时代&#xff0c;大开关作为计算机硬件中的重要组成部分&#xff0c;发挥着至关重要的作用。本文将详细介绍大开关的基本概念、原理以及在计算机…

利用Matplotlib画简单的线形图

实验题目&#xff1a;简单的线形图 实验目的&#xff1a;利用Matplotlib画简单的线形图 实验环境&#xff1a;海豚大数据和人工智能实验室&#xff0c;使用的Python库 名称 版本 简介 numpy 1.16.0 线性代数 Pandas 0.25.0 数据分析 Matplotlib 3.1.0 数据可视化 …

CMake项目管理

背景 目前看到很过很多框架&#xff0c;很好奇大家如何从头搭建一个C的库&#xff0c;这里简单介绍一个基本模板. 参考&#xff1a;https://zhuanlan.zhihu.com/p/631257434 目录组织 假如项目名称叫project&#xff0c; 一般可以按照下面的方式组织代码&#xff0c;这里可以…

深入浅出堆排序: 高效算法背后的原理与性能

&#x1f3ac; 鸽芷咕&#xff1a;个人主页 &#x1f525; 个人专栏: 《linux深造日志》 《高效算法》 ⛺️生活的理想&#xff0c;就是为了理想的生活! &#x1f4cb; 前言 &#x1f308;堆排序一个基于二叉堆数据结构的排序算法&#xff0c;其稳定性和排序效率在八大排序中也…

浏览器开发者工具(Developer Tools)详解

作为一名前端开发人员&#xff0c;熟练应用浏览器开发工具很重要。笔者在这方面的知识未成体系&#xff0c;最近在跟着chorme官方文档学习&#xff0c;于是整理了本文&#xff0c;如有不足&#xff0c;欢迎指正。 目录 1.elements(元素) 2.console(控制台) 3.sources(源代码…
最新文章