📄 bullet.h
字号:
#ifndef BULLET_H
#define BULLET_H
// 定义子弹基类
class Bullet:public Sprite
{
protected:
void SetMovement(double speed, int angle);
public:
static enum BULLET_TYPE { PLAYER_BULLET_FIRE, PLAYER_BULLET_MISSILE, PLAYER_BULLET_ROUND_BULLET,PLAYER_BULLET_BIG_BULLET, ENERMY_BULLET_1, ENERMY_BULLET_2, ENERMY_BULLET_3, BULLET_COUNT};
//定义敌机和玩家战斗机的子弹类型各有三种类型;
void Update();
static int GetFireInterval(BULLET_TYPE BulletType);//设计子弹的类型和运行时的速度
Bullet(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy);// 构造函数
};
//为每一种子弹定义一个类,其都为子弹基类的派生类
class PlayerBullet_Big:public Bullet
{
public:
PlayerBullet_Big(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy);
};
// PLAYER_BULLET_FIRE类
class PlayerBullet_Fire:public Bullet
{
public:
PlayerBullet_Fire(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy);
};
// Missile导弹类
class PlayerBullet_Missile:public Bullet
{
int Angle, dAngle;
int x0, Range;
public:
PlayerBullet_Missile(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
void Update();
};
// RoundBullet散弹类
class PlayerBullet_RoundBullet:public Bullet
{
public:
PlayerBullet_RoundBullet(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};
// 敌机EnermyBullet1的子弹类
class EnermyBullet1:public Bullet
{
public:
EnermyBullet1(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};
// 敌机EnermyBullet2的子弹类
class EnermyBullet2:public Bullet
{
public:
EnermyBullet2(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};
//敌机EnermyBullet3的子弹类
class EnermyBullet3:public Bullet
{
public:
EnermyBullet3(GameWorld *pgw, int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -