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

📄 cwall.h

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

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

	#define	WALL_SIZE_WIDTH			80
	#define WALL_SIZE_HEIGHT		80
	#define WALL_BASIC_STRENGTH		1000

	#define WALL_TYPE_1				0
	#define WALL_TYPE_2				1
	#define WALL_TYPE_3				2
	#define WALL_TYPE_4				3
	#define WALL_TYPE_5				4
	#define WALL_TYPE_6				5
	#define WALL_TYPE_7				6
	#define WALL_TYPE_8				7
			
	#define WALL_STATE_VISIBLE		1
	#define TANK_STATE_BEATTACK		2


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


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

	struct CWallNode;
	class CWall;

//-----------------------------------------------------------------------------
//
// Name:	CWALLNode	
// Disc:	the structure of the node of the WALL
//-----------------------------------------------------------------------------

	typedef struct CWallNode
	{
		BOOL m_nState;			// the attritude of tank deside whether the tank is exist or not
		int  m_nType;			// the type of the WALL , it will effect its power and lifecount
		int  m_nLifeCount;		// the lifecount of the WALL
		RECT m_rRect;			// the rect of the wall
	}WALLNODE,*PWALLNODE;

//-----------------------------------------------------------------------------
//
// Name:	CWALL
// Disc:	the structure of the class of the WALL
//-----------------------------------------------------------------------------
	
	typedef class CWall
	{
	protected:

		WALLNODE	m_wWall;				// the node of the WALL
		POINT		m_ptNowPos;				// the present position of the WALL
		int 		m_nWallState;			// the present state of the WALL  

	public:

		CWall();
		CWall( int type,int lifecount,POINT point,
			   int top,int bottom,int left,int right);

	public:
		
		void SetLifeCount( int lifecount )  { m_wWall.m_nLifeCount=lifecount; };
		void SetType( int type )            { m_wWall.m_nType=type;			  };
		void SetLifeState( BOOL state )     { m_wWall.m_nState=state;         };
		void SetWallState( BOOL wallstate ) { m_nWallState=wallstate;         };
		void SetNowPos( int x,int y )	    { m_ptNowPos.x=x; m_ptNowPos.y=y; };
		void SetWallRect(int top,int bottom,int left,int right )
						{	m_wWall.m_rRect.top=top; m_wWall.m_rRect.bottom=bottom;
							m_wWall.m_rRect.left=left; m_wWall.m_rRect.right=right; };

		void SetWall(POINT point,int type);

		BOOL IsVisible()    { return m_nWallState==WALL_STATE_VISIBLE;  };
		BOOL IsLiving()     { return m_wWall.m_nState==TRUE;			};
		BOOL IsBeAttacked() { return m_nWallState==TANK_STATE_BEATTACK; };
		
		int	   GetLifeCount() { return m_wWall.m_nLifeCount; };
		POINT  GetWallPos()   { return m_ptNowPos;           };
		int	   GetType()	  { return m_wWall.m_nType;      };

		void   BeAttacked(int power);

	}WALL,*PWALL;

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

⌨️ 快捷键说明

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