⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bullet.h

📁 射击小游戏
💻 H
字号:
// Bullet.h: interface for the Bullet class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BULLET_H__5ADFFDE8_F212_4FF7_96F9_BC53DEEAAAD5__INCLUDED_)
#define AFX_BULLET_H__5ADFFDE8_F212_4FF7_96F9_BC53DEEAAAD5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//***************************************************************
//子弹基类定义。继承于BaseObject类。又派生出六个类
//以下三个类是主角的子弹类型:Bullet_Fire,Bullet_Missile,PlayerBullet_RoundBullet
//以下三种子弹是敌军子弹EnermyBullet1,EnermyBullet2,EnermyBullet3
//***************************************************************

#include "BaseObject.h"
#include "MyDefine.h"

enum BULLET_TYPE{PLAYER_MISSILE,PLAYER_ROUND,PLAYER_FIRE,ENEMY_B1,ENEMY_B2,ENEMY_B3};
//Bullet类定义
class Bullet : public BaseObject 
{
public:
	Bullet(int x_value,int y_value,double vx_value,double vy_value);//构造函数
	static int GetFireInterval(BULLET_TYPE BulletType);//获得两次发火间隔时间
	void Update();//更新函数
	int m_iExplosionFrameIndex,m_iExplosionFrameCount;//爆炸图片的总张数和已经贴的张数
protected:
	void SetMovement(double speed, int angle);//设置子弹运动情况
};
////////////////////////////////////////////////////
//主角子弹:迫击炮
class Bullet_Fire:public Bullet
{
public:
	Bullet_Fire(int x_value,int y_value,double vx_value,double vy_value);
	
};
////////////////////////////////////////////
//主角子弹:导弹
class Bullet_Missile:public Bullet
{
	int m_iAngle, m_idAngle;//导弹有自己的角度和角度的变化量,角度是基于通常的笛卡儿坐标系的
	int m_ix0, m_iRange;//初始坐标和左右扫描的范围
public:
	Bullet_Missile(int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
	void Update();
};

//主角子弹:散弹
class PlayerBullet_RoundBullet:public Bullet
{
public:
	PlayerBullet_RoundBullet(int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};

// 敌军子弹1
class EnermyBullet1:public Bullet
{
public:
	EnermyBullet1(int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};

// 敌军子弹2
class EnermyBullet2:public Bullet
{
public:
	EnermyBullet2(int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};

// 敌军子弹3
class EnermyBullet3:public Bullet
{
public:
	EnermyBullet3(int x_value, int y_value, double sprite_vx, double sprite_vy, int angle);
};

#endif // !defined(AFX_BULLET_H__5ADFFDE8_F212_4FF7_96F9_BC53DEEAAAD5__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -