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


C++ ParticleSystem::CreateBurst方法代码示例

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


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

示例1: resetEnemies

void EnemySystem::resetEnemies(SDL_Renderer* renderer, Player &player, ParticleSystem &pas)
{
	pas.CreateBurst(player.getX(), player.getY(), 60, renderer);
	player.getActive() = false;
	player.resetSpeed();
	shakeIntensity += 250;
	spawnReset += (300 - spawnReset) / 4;

	for (int x = 0; x < fEnemyList.size(); x++)
	{
		pas.CreateBurst(fEnemyList[x].getX(), fEnemyList[x].getY(), 25, renderer);
		fEnemyList.erase(fEnemyList.begin() + x);
		shakeIntensity += 10;
	}
	for (int x = 0; x < bEnemyList.size(); x++)
	{
		pas.CreateBurst(bEnemyList[x].getX(), bEnemyList[x].getY(), 25, renderer);
		bEnemyList.erase(bEnemyList.begin() + x);
		shakeIntensity += 10;
	}
}
开发者ID:eric-zdw,项目名称:dueric_summative-sdl-git,代码行数:21,代码来源:EnemySystem.cpp

示例2: moveEnemies

//moves every enemy in the enemy lists;
//if the enemy is "inactive" (usually zero health)
//the enemy is taken out of the list
//and particles are created;
//touching players will destroy the player.
void EnemySystem::moveEnemies(ProjectileSystem &ps, Player &player, ParticleSystem &pas, SDL_Renderer *renderer)
{
	for (int x = 0; x < fEnemyList.size(); x++)
	{
		if (fEnemyList[x].getStatus() == true)
		{
			fEnemyList[x].getDirection(player);
			fEnemyList[x].move(player);
		}
		else
		{
			pas.CreateBurst(fEnemyList[x].getX(), fEnemyList[x].getY(), 25, renderer);
			fEnemyList.erase(fEnemyList.begin() + x);
			shakeIntensity += 25;
		}
	}
	for (int x = 0; x < bEnemyList.size(); x++)
	{
		if (bEnemyList[x].getStatus() == true)
		{
			bEnemyList[x].move();
		}
		else
		{
			pas.CreateBurst(bEnemyList[x].getX(), bEnemyList[x].getY(), 25, renderer);
			bEnemyList.erase(bEnemyList.begin() + x);
			shakeIntensity += 25;
		}
	}


	for (int x = 0; x < fEnemyList.size(); x++)
	{
		for (int y = 0; y < ps.getList().size(); y++)
		{
			//SDL built-in rectangle collision detection
			if (SDL_HasIntersection(&fEnemyList[x].getCollisionBox(), &ps.getList()[y].getCollisionBox()) == SDL_TRUE)
			{
				fEnemyList[x].loseHealth(ps.getList()[y].getDamage());
				ps.getList()[y].active = 0;
				shakeIntensity += 5;
				pas.CreateBurst(ps.getList()[y].getX(), ps.getList()[y].getY(), 3, renderer);
			}
		}
		if (SDL_HasIntersection(&fEnemyList[x].getCollisionBox(), &player.getCollision()) == SDL_TRUE && player.getActive() == true)
		{
			//destroy player, destroy all enemies and increase enemy spawn timer
			resetEnemies(renderer, player, pas);
		}
	}

	for (int x = 0; x < bEnemyList.size(); x++)
	{
		for (int y = 0; y < ps.getList().size(); y++)
		{
			if (SDL_HasIntersection(&bEnemyList[x].getCollisionBox(), &ps.getList()[y].getCollisionBox()) == SDL_TRUE)
			{
				bEnemyList[x].loseHealth(ps.getList()[y].getDamage());
				ps.getList()[y].active = 0;
				shakeIntensity += 5;
				pas.CreateBurst(ps.getList()[y].getX(), ps.getList()[y].getY(), 3, renderer);
			}
		}
		if (SDL_HasIntersection(&bEnemyList[x].getCollisionBox(), &player.getCollision()) == SDL_TRUE && player.getActive() == true)
		{
			resetEnemies(renderer, player, pas);
		}
	}

	reduceDelay--;
	if (spawnReset > 40 && reduceDelay <= 0)
	{
		spawnReset -= 4;
		reduceDelay = 150;
		std::cout << spawnReset << std::endl;
	}

}
开发者ID:eric-zdw,项目名称:dueric_summative-sdl-git,代码行数:83,代码来源:EnemySystem.cpp


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