大一下小学期看了知乎上童晶老师的书《“c语言开发设计与游戏开发实践”》,看到飞机大战
那部分兴致大增,遂决定自己也来写一个。
程序用的是单纯的C语言,调用了EasyX库的函数。
编译环境:Visual Studio ,VC6.0。
内容:对书本中原有代码进行了扩充:包括子弹种类;子弹形态、数目的改变;敌机种类;BOSS;速度and so on。
其中子弹,补给包的遮罩图都是用PS自己画的,boss和其发射的激光炮都是网上的,激光炮是不是有点眼熟呢勇士~
#include <graphics.h>
#include <conio.h>
#include <math.h>
#include <stdio.h>
// 引用 Windows Multimedia API
#pragma comment(lib,"Winmm.lib")
#define High 579 // 游戏画面尺寸
#define Width 1024
IMAGE img_bk; // 背景图片
float position_x,position_y; // 飞机位置
float bullet_x,bullet_y; // 子弹位置
float enemy_x,enemy_y; // 敌机位置
float enemy2_x,enemy2_y;// 敌机位置
float enemy3_x,enemy3_y;// 敌机位置
IMAGE img_planeNormal1,img_planeNormal2; // 正常飞机图片
IMAGE img_planeExplode1,img_planeExplode2; // 爆炸飞机图片
IMAGE img_bullet1,img_bullet2; // 子弹图片
IMAGE img_enemyPlane1,img_enemyPlane2,img_enemyPlane3,img_enemyPlane4; // 敌机图片
int isExpolde = 0; // 飞机是否爆炸
int shengming = 3;//生命
int score = 0; // 得分
int gu