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

📄 explode.cpp

📁 在vc 6.0环境下的一个坦克小游戏
💻 CPP
字号:
// Explode.cpp: implementation of the CExplode class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "tank.h"
#include "Explode.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CExplode::CExplode()
{
	m_bmpExplode=NULL;
	m_nTotalBmps=NUM_EXPLODES;
	m_nIndex=0;
	m_nSort=0;
	m_nCycles=1;
	m_nTimes=0;
	x=0;y=0;w=32;h=24;
}

CExplode::~CExplode()
{

}

void CExplode::DrawExplode(LPDIRECTDRAWSURFACE pdds)
{
	if(m_bmpExplode)
	{
		RECT rc;
		rc.left=m_nIndex * w;
		rc.top=0;
		rc.right=rc.left + w;
		rc.bottom=h;
		pdds->BltFast( x, y, m_bmpExplode, &rc, DDBLTFAST_SRCCOLORKEY | DDBLTFAST_WAIT );
	}
}

void CExplode::SetPostion(int xt, int yt)
{
	x=xt;y=yt;
}

BOOL CExplode::Burn()
{
	m_nIndex++;
	if(m_nIndex>=m_nTotalBmps)
	{
		m_nIndex=0;
		m_nTimes++;
		if(m_nTimes >= m_nCycles)
			return FALSE;
	}
	return TRUE;
}

BOOL CExplode::Init(int xt, int yt, int iCycles, int iTotalBmps,LPDIRECTDRAWSURFACE bmp,int iw,int ih,int iSort,int iSide)
{
	x=xt;y=yt;
	m_nCycles=iCycles;
	m_nTotalBmps=iTotalBmps;
	m_bmpExplode=bmp;
	w=iw;h=ih;
	m_nSort=iSort;
	m_nSide=iSide;
	return TRUE;
}

⌨️ 快捷键说明

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