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 ==