コード例 #1
0
void COptions::Enter()
{
	m_nCursorPosition = 75;

	CSGD_TextureManager *pTM = CSGD_TextureManager::GetInstance();
	CSGD_WaveManager *pWM = CSGD_WaveManager::GetInstance();
	
	m_nImageID[0] = pTM->LoadTexture("Resource\\JoA_earthwormjim-items.png", D3DCOLOR_XRGB(0,128,255));
	m_nImageID[1] = pTM->LoadTexture("Resource\\JoA_OptionsBar.bmp", D3DCOLOR_XRGB(255,0,255));

	m_nSoundID[0] = pWM->LoadWave("Resource/sounds/JoA_Bosssnatchprincess.wav");
	m_nSoundID[1] = pWM->LoadWave("Resource/sounds/JoA_Song3.wav");

}
コード例 #2
0
void CGamePlay::Enter()
{
	COptions *op = COptions::GetInstance();
	CSGD_ObjectFactory<string, CBase> *pOF		= CSGD_ObjectFactory<string, CBase>::GetInstance();
	CSGD_ObjectManager *pOM						= CSGD_ObjectManager::GetInstance();
	CSGD_TextureManager *pTM					= CSGD_TextureManager::GetInstance();
	CPlayerCharacter *pPC						= CPlayerCharacter::GetInstance();
	CSGD_EventSystem *pEM						= CSGD_EventSystem::GetInstance();
	CSGD_DirectSound *pDS						= CSGD_DirectSound::GetInstance();
	CSGD_WaveManager* pWM						= CSGD_WaveManager::GetInstance();


	m_nBridgeOffset = 0;
	m_nSpaceOffset = 0;
	m_nEnemyCounter = 0;
	m_nTotalSpawns = 0;

	stateTimer = 6.0f;
	m_fSpawnPowerupTimer = 15.0f;

	//	Register classes with ObjectFactory
	pEM->RegisterClient("scroll right", this);
	pEM->RegisterClient("scroll left", this);
	pEM->RegisterClient("spawn enemies",this);
	pEM->RegisterClient("spawn powerups",this);

	pOF->RegisterClassType<CPlayerCharacter>("CPlayerCharacter");
	pOF->RegisterClassType<CBullet>("CBullet");
	pOF->RegisterClassType<CEnemyDemon>("CEnemyDemon");
	pOF->RegisterClassType<CEnemyBusiness>("CEnemyBusiness");
	pOF->RegisterClassType<CBulletPaper>("CBulletPaper");
	pOF->RegisterClassType<CEnemyMeat>("CEnemyMeat");
	pOF->RegisterClassType<CBulletFire>("CBulletFire");
	pOF->RegisterClassType<CEnemyBooger>("CEnemyBooger");
	pOF->RegisterClassType<CPowerup1up>("CPowerup1up");
	pOF->RegisterClassType<CPowerupHealth>("CPowerupHealth");
	pOF->RegisterClassType<CPowerupRapidFire>("CPowerupRapidFire");
	pOF->RegisterClassType<CPowerupThreeWay>("CPowerupThreeWay");
	pOF->RegisterClassType<CEnemyPsycrow>("CEnemyPsycrow");
	pOF->RegisterClassType<CBulletHook>("CBulletHook");

	m_nImageID[0] = pTM->LoadTexture("Resource\\JoA_EarthwormJim.bmp", D3DCOLOR_XRGB(80,192,64));
	m_nImageID[1] = pTM->LoadTexture("Resource\\JoA_jim_level2enemies.png",D3DCOLOR_XRGB(0,64,128));
	m_nImageID[2] = pTM->LoadTexture("Resource\\JoA_ewj2-flaminyawn.png",D3DCOLOR_XRGB(0,64,128));
	m_nImageID[3] = pTM->LoadTexture("Resource\\JoA_earthwormjim-items.png",D3DCOLOR_XRGB(0,128,255));
	m_nImageID[4] = pTM->LoadTexture("Resource\\JoA_ewj_forpete.png",D3DCOLOR_XRGB(0,64,128));
	m_nBGID		  = pTM->LoadTexture("Resource\\JoA_jim_psycro.png", D3DCOLOR_XRGB(0,64,128));

	pOM->AddObject(CPlayerCharacter::GetInstance());

	m_fFinishedTimer = 5.0f;

	m_Font.SetFontImageID( CSGD_TextureManager::GetInstance()->LoadTexture("resource/JoA_023 - small.bmp", D3DCOLOR_XRGB(0, 0, 0)) );
	m_Font.SetCharWidth( 16 );
	m_Font.SetCharHeight( 16 );
	m_Font.SetNumCols( 10 );
	m_Font.SetStartChar( ' ' );

	m_Font2.SetFontImageID( CSGD_TextureManager::GetInstance()->LoadTexture("resource/JoA_023 - large.bmp", D3DCOLOR_XRGB(0, 0, 0)) );
	m_Font2.SetCharWidth( 32 );
	m_Font2.SetCharHeight( 32 );
	m_Font2.SetNumCols( 10 );
	m_Font2.SetStartChar( ' ' );

	pPC->SetBulletScale(1.0f);
	pPC->SetRateOfFire(7);
	pPC->SetHP(100);
	pPC->SetPosX( 100.0f );
	pPC->SetImageID(m_nImageID[0]);
	pPC->SetThreeWay(false);
	pPC->SetGodMode(false);
	pPC->SetVelX(0.00000004f);
	pPC->SetVelY(0.00000004f);
	pPC->SetInvulnerable(false);
	pPC->SetRapidFireTimer(0.0f);
	pPC->SetThreeWayTimer(0.0f);
	if (GetLevel() == 1)
	{
		pPC->SetPosY( 202.0f );
		SetRemainingEnemies(10);
		m_nBGMusicID = pWM->LoadWave("Resource/sounds/JoA_Song3.wav");
		pWM->SetVolume(m_nBGMusicID,op->GetMusicVolume() - 25);
	}
	else if (GetLevel() == 2)
	{
		pPC->SetPosY(375.0f);
		SetRemainingEnemies(10);
		m_nBGMusicID = pWM->LoadWave("Resource/sounds/JoA_Song4.wav");
		pWM->SetVolume(m_nBGMusicID,op->GetMusicVolume() - 25);
	}
	else if (GetLevel() == 3)
	{
		pPC->SetPosY(250.0f);
		SetRemainingEnemies(1);
		m_nBridgeOffsetY = 300;
		m_nBridgeVelocityY = 25 * op->GetDifficulty();
		pEM->SendEvent("spawn enemies", NULL);
		m_nBGMusicID = pWM->LoadWave("Resource/sounds/JoA_Song2.wav");
		pWM->SetVolume(m_nBGMusicID,op->GetMusicVolume() - 25);
	}

	pWM->Play(m_nBGMusicID,1);
}