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

📄 spirit.h

📁 一个完整的2D滚屏游戏示例
💻 H
字号:
#ifndef _SPIRIT_H
#define _SPIRIT_H

#include "stdafx.h"

class CSpirit;
class CSpirit
{
public:
int  m_nPace;         //Spirit步进量;

int  m_nX;
int  m_nY;

int  m_nWidth;
int  m_nHeight;

RECT m_rcSource;  //the Spirit's rect on the source map(all.bmp);   
int  m_nDyingPage;//control the dying proccess;

UINT m_uSpeed;        //the action speed of the spirite;

int  m_nCosmos;       //小宇宙,每一个实体都具备,这是他们在大宇宙中存在的条件;

bool m_bActive;      //是否开始运动?----可能是在屏幕以外;物理问题!! 
bool m_bAlive;       //是否活着,逻辑问题!! 
bool m_bCollided;

public: 
	CSpirit();
	CSpirit(int nSourceX,int nSourceY,int nWidth,int nHeight,int nX,int nY,bool bActive=true,bool bAlive=true,int nPace=10);
	int   GetShowX(){return m_nX;};
	int   GetShowY(){return m_nY;};
    
	virtual void Trace(MSG msg,UINT t){return;}//the trace of the object on the screen;
	
	//virtual 
		void Activate(){m_bActive=true;m_bAlive=true;return;}
	//virtual 
		void BeCollided(int nCosmos){m_nCosmos-=nCosmos;if(m_nCosmos<=0){m_bActive=true;m_bAlive=false;}return;}  //if a spirit be collided,u should do something;
	//virtual 
		void BeColliding(CSpirit* pSpirit){return;}  //if a spirit be collided,u should do something;
	//virtual
		void DyingTrace(int nSpiritID);
	
	bool Collison(CSpirit spirit);
    
};//end declare od CSpirit;


#endif

⌨️ 快捷键说明

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