雷霆战机

这篇博客详细介绍了雷霆战机游戏的开发过程,包括draw类用于绘制背景和飞机,CONTROL类管理炮弹发射和敌机随机出现,EXPLODE类处理爆炸效果,而UPGRADE类则实现了子弹升级功能。
摘要由CSDN通过智能技术生成

plane.h的内容
#pragma once
#include <graphics.h>
#include
#include <conio.h>
#include <Windows.h>
#include <stdlib.h>
#include
#include <MMsystem.h>
#pragma comment(lib,“Winmm.lib”)

class draw
{
public:
void draw_bcakground();
void draw_plane();

};
class CONTROL
{
public:
IMAGE paodan1;
IMAGE paodan2;
void remove();
void fire();//炮弹发射,偏离位置后,又从原位置发射
void random();//随机出现敌机,总共三部
//消失后又在任意位置出现

};
class EXPLODE
{
public:
IMAGE blast1;
IMAGE blast2;
void blast(int& a, int& b, int j, int i);//爆炸,位置匹配,放出爆炸图片
void sum_blast();

};
class UPGRADE :public EXPLODE//升级
{
public:
void speed_upgrade();//加速子弹升级
void replace_upgrade(int& a, int& b, int j, int i);//炮弹增多升级
void sum_upgrade();
};

plane.cpp的内容

using namespace std;
int x = 200, y = 300;
int x2 = 375, y2 = 200;
int x3 = 130, y3 = 50;
int x4 = 600, y4 = 50;
int x5 = 235, y5 = 50;
int x6 = 425, y6 = 200;
int arr[10];
int sum = 0;
#define wide 800
#define height 600
void draw::draw_bcakground ()
{
	IMAGE background;
	loadimage(&background, L"background.jpg", wide, height);
	putimage(0, 0, &background);

}
void draw::draw_plane()
{
	IMAGE plane1;
	IMAGE plane2;
	loadimage(&plane1, L"plane1.jpg", 400, 300);
	loadimage(&plane2, L"plane2.jpg", 400, 300);
	putimage(x, y, &plane1, SRCPAINT);
	putimage(x, y, &plane2, SRCAND);
}
	void CONTROL::remove()
	{

		if (_kbhit())//战机移动
		{
			char control;
			control = _getch();
			if (control == 'W')
			{
				y -= 10;
				y2 -= 10;
				y6 -= 10;
			}
			if (control ==
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值