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

📄 cbullet.h

📁 本游戏是一款单机版的坦克大战游戏
💻 H
字号:
//////////////////////////////////////////////////////////////////////////////////////////////////
//      #                                                                               #       //
//		#		* File Name:	CBullet.h												#	    //
//		#																				#	    //
//		#		* Function:		the engine of the game									#	    //
//		#																				#	    //
//		#		* Instruction:	Created by JIAN NAN FEI 2008 8 29						#	    //
//      #                                                                               #       //
///////////////////////////////////////////////////////////////////////////////////////////////////

//----------------------------------------------------------------------------------------------//
//										DEFINES REFERENCES HERE									//
//----------------------------------------------------------------------------------------------//

	#define BULLET_BASIC_POWER		300
	#define BULLET_BASIC_SPEED		3
	#define BULLET_SIZE_WIDTH		20
	#define BULLET_SIZE_HEIGHT		28

	#define BULLET_FLYING_UP			0
	#define BULLET_FLYING_DOWN		1
	#define BULLET_FLYING_LEFT		2
	#define BULLET_FLYING_RIGHT		3

	#define BULLET_BREAK           -1
	#define BULLET_FLYING           1
	#define BULLET_FLYING_READY     0

	#define BULLET_TYPE_1			1
	#define BULLET_TYPE_2			2
	#define BULLET_TYPE_3			3

//----------------------------------------------------------------------------------------------//
//										HEADFILES REFERENCES HERE								//
//----------------------------------------------------------------------------------------------//


//----------------------------------------------------------------------------------------------//
//										GLOBAL MEMBER VARIAYS REFERENCES HERE					//
//----------------------------------------------------------------------------------------------//

	struct CBulletNode;
	class  CBullet;

//-----------------------------------------------------------------
//
// Name: struct CBulletNode
// Instruction: the structure of the bullet
//
//-----------------------------------------------------------------

	typedef struct CBulletNode
	{
		BOOL m_bState;
		int  m_nPower;
		int  m_nType;
	}BULLET,*LPBULLET;

//-----------------------------------------------------------------
//
// Name: class CBullet
// Instruction: the class structure of the bullet
//
//-----------------------------------------------------------------

	class CBullet
	{
	private:

		BULLET m_bBullet;
		POINT  m_ptNowPos;
		int	   m_nBelong;
		int    m_nSpeed;
		int    m_nFlyingDirection;
		int    m_nBulletState;

		int    frame;
		int    framep;
		int    bframe;
		int    bframep;
		POINT  boompos;
		BOOL   boom;

	public:
		CBullet();
		CBullet(int x,int y,int belong,int type,int power,int speed,int direction);
		~CBullet(){};
	public:

		void SetBoom(BOOL bm)			 { boom=bm;							 };
		void SetFrame(int fm,int fmp)	 { frame=fm; framep=fmp;			 };
		void SetBFrame(int fm,int fmp)	 { bframe=fm; bframep=fmp;			 };
		void SetBoomPos(int x,int y)	 { boompos.x=x; boompos.y=y;		 };

		void SetLifeState(BOOL state)    { m_bBullet.m_bState=state;	     };
		void SetPower(int power)		 { m_bBullet.m_nPower=power;		 };
		void SetType(int type)			 { m_bBullet.m_nType;				 };
		void SetSpeed(int speed)		 { m_nSpeed=speed;					 };
		void SetNowPos(int x,int y)		 { m_ptNowPos.x=x; m_ptNowPos.y=y;   };
		void SetBelong(int belong)       { m_nBelong=belong;				 };
		void SetBulletState(int state)   { m_nBulletState=state;			 };
		void SetFlyingDirection(int direction) {m_nFlyingDirection=direction;};
		void SetBullet(int type,int belong,int direction);

		BOOL IsFlying() { return m_bBullet.m_bState==TRUE;     };
		BOOL IsBreak()  { return m_nBulletState==BULLET_BREAK; };
		
		void Break();
		void Flying();

		int GetPower() { return m_bBullet.m_nPower;     };
		int GetType()  { return m_bBullet.m_nType;      };
		int GetSpeed() { return m_nSpeed;				};
		int GetBelong(){ return m_nBelong;				};
		int GetBulletState() { return m_nBulletState;   };
		POINT GetNowPos() { return m_ptNowPos;			};
		int GetFlyingDirection() { return m_nFlyingDirection; };

		int GetFrame()		{ return frame;     };
		int GetFramep()		{ return framep;    };
		int GetBFrame()		{ return bframe;    };
		int GetBFramep()	{ return bframep;   };
		POINT GetBoomPos()  { return boompos;   };
		BOOL IsBoom()		{ return boom==TRUE;};

	};

//----------------------------------------------------------------------------------------------//
//										COMPLISHMENT OF THE FILE    							//
//----------------------------------------------------------------------------------------------//

⌨️ 快捷键说明

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