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

📄 bigbomb.cpp

📁 一个坦克大战的源码
💻 CPP
字号:
// BigBomb.cpp: implementation of the CBigBomb class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "BigBomb.h"
#include "MainGame.h"
#include "Explode.h"

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

CBigBomb::CBigBomb():CContainerObject(this)
{
	sndPlaySound("sound//bombfall.wav",SND_ASYNC|SND_NODEFAULT);
	positionX=32;
	positionY=14*32;
	stage = 0;
}

CBigBomb::~CBigBomb()
{

}

void CBigBomb::displayObject()
{
	CMainGame *pWnd=(CMainGame*)AfxGetMainWnd();
	DDSetColorKey(pWnd->lpBKGObject[15],RGB(4,4,4));
	for(int i=0;i<23;i+=2)
	{
	if(i==10)i--;
	pWnd->lpBackBuffer->Blt(
		CRect(positionX+i*32,positionY,positionX+i*32+35,positionY+35),//dest rect  22*22
		pWnd->lpBKGObject[15],//src surface
		CRect(0,0,35,35),//src rect
		DDBLT_WAIT|DDBLT_KEYSRC, 
		NULL);
	}
}

bool CBigBomb::ActiveObject()
{
	CMainGame *pMainGame=(CMainGame*)AfxGetMainWnd();
	if(stage++>400)return false;
	else 
	{
		int i=(stage/13)*2;
		if(stage%10==0)
		{
			if(stage==80)
				sndPlaySound("sound//Bombexp.wav",SND_ASYNC|SND_NODEFAULT);
			for(int j=0;j<20;j++)
			{
				if(pMainGame->theMap->Map[15-i][j]==0)
				{
					CExplode *bomb=new CExplode(32*j,32*(15-i),5);
				}
			}
		}
		CBigBomb::displayObject();
		positionY-=4;
		return true;
	}
}


⌨️ 快捷键说明

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