当前位置: 首页>>代码示例>>C++>>正文


C++ ParticleManager::Start_Explosion方法代码示例

本文整理汇总了C++中ParticleManager::Start_Explosion方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleManager::Start_Explosion方法的具体用法?C++ ParticleManager::Start_Explosion怎么用?C++ ParticleManager::Start_Explosion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleManager的用法示例。


在下文中一共展示了ParticleManager::Start_Explosion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

void BasicApp::update()
{

	if (game_state == Game_Demo)
	{

		for (list<Asteroid>::iterator itr = asteroids.begin(); itr!=asteroids.end(); itr++)
		{
			itr->Update();

		}

	}
	else if(game_state == GAME_Play)
	{
		for (list<Asteroid>::iterator itr = asteroids.begin(); itr!=asteroids.end(); itr++)
		{
			itr->Update();

		}

		for (list<Bullet>::iterator itr_bullet = currentShip.m_Bullets.begin(); itr_bullet!=currentShip.m_Bullets.end();)
		{

			for (list<Asteroid>::iterator itr_astroid = asteroids.begin(); itr_astroid!=asteroids.end();)
			{
				if(checkCollision(itr_bullet->getCenter(),itr_astroid->getCenter(), itr_bullet->getRadius(), itr_astroid->getRadius()))
				{

					particleManager.Start_Explosion(itr_astroid->getCenter(),10,1.0f,1.0f);
				
					engine->play2D("explode_high.wav");
				

					if(itr_astroid->m_size >= 0.5)
					{
						Asteroid asteroid_1, asteroid_2;

						asteroid_1.m_state = Asteroid_Medium;
						asteroid_1.Init(rand()%2+1, 0.3);
						asteroid_1.m_Vel.y = -itr_astroid->m_Vel.y*1.5;
						asteroid_1.m_Vel.x = -itr_astroid->m_Vel.x*1.5;
						asteroid_1.m_Pos = itr_astroid->m_Pos;

						asteroid_2.m_state = Asteroid_Medium;
						asteroid_2.Init(rand()%2+1, 0.3);
						asteroid_2.m_Vel.y = itr_astroid->m_Vel.y*1.5;
						asteroid_2.m_Vel.x = itr_astroid->m_Vel.x*1.5;
						asteroid_2.m_Pos = itr_astroid->m_Pos;


						asteroids.push_back(asteroid_1);
						asteroids.push_back(asteroid_2);


						itr_astroid = asteroids.erase(itr_astroid);
						itr_astroid->m_bHit = true;

						score +=100;

					}
					else if(itr_astroid->m_state == Asteroid_Medium)
					{
						Asteroid asteroid_1, asteroid_2;
						asteroid_1.m_state = Asteroid_Small;
						asteroid_1.Init(rand()%2+1, 0.1);
						asteroid_1.m_Vel.y = -itr_astroid->m_Vel.y*2;
						asteroid_1.m_Vel.x = -itr_astroid->m_Vel.x*2;
						asteroid_1.m_Pos = itr_astroid->m_Pos;
						asteroid_2.m_state = Asteroid_Small;
						asteroid_2.Init(rand()%2+1, 0.1);
						asteroid_2.m_Vel.y = itr_astroid->m_Vel.y*2;
						asteroid_2.m_Vel.x = itr_astroid->m_Vel.x*2;
						asteroid_2.m_Pos = itr_astroid->m_Pos;
						asteroids.push_back(asteroid_1);
						asteroids.push_back(asteroid_2);
						itr_astroid = asteroids.erase(itr_astroid);
						itr_astroid->m_bHit = true;

						score +=100;

					}
					else
					{
						score +=50;
						itr_astroid->m_bHit = true; 
						itr_astroid = asteroids.erase(itr_astroid);
					}

					itr_bullet->m_Hit = true;

					break;
				}
				else
				{
					itr_astroid++;

				}
			}
			if(itr_bullet->m_Hit)
//.........这里部分代码省略.........
开发者ID:AndreAhmed,项目名称:asteroids-atari-clone,代码行数:101,代码来源:basicApp.cpp


注:本文中的ParticleManager::Start_Explosion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。