C/C++代码库:飞机大战
发布时间
阅读量:
阅读量
这是一个由我自行编写的飞机大战游戏源代码,目前仍处于开发初期阶段,仅实现了玩家控制的飞机与敌方飞机的基本功能。通过键盘上的上下左右四个方向键可操控我方战机的移动,按下空格键则可触发射击动作。用户可根据需求自行扩展更多功能,例如添加子弹与敌机碰撞后产生爆炸效果等交互内容。以下是当前已完成的项目代码部分。
plane.cpp
#include "plane.h"
Plane::Plane()
{
}
Plane::Plane(int x, int y, char *imgURL, char *imgURLY, int speed)
{
this->x = x;
this->y = y;
loadimage(img + 1, imgURL); //背景图
loadimage(img + 0, imgURLY);
this->speed = speed;
}
void Plane::drawPlane() //画飞机
{
//SRCAND 方式贴掩码图
putimage(x, y, img + 0,SRCAND);
//SRCPAIN方式贴图背景图
putimage(x, y, img
全部评论 (0)
还没有任何评论哟~
