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


C++ Explosion类代码示例

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


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

示例1: try_break

HitResponse
Brick::collision(GameObject& other, const CollisionHit& hit_){

  Player* player = dynamic_cast<Player*> (&other);
  if (player) {
    if (player->does_buttjump) try_break(player);
  }

  BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
  if(badguy) {
    // hit contains no information for collisions with blocks.
    // Badguy's bottom has to be below the top of the brick
    // SHIFT_DELTA is required to slide over one tile gaps.
    if( badguy->can_break() && ( badguy->get_bbox().get_bottom() > get_bbox().get_top() + SHIFT_DELTA ) ){
      try_break(player);
    }
  }
  Portable* portable = dynamic_cast<Portable*> (&other);
  if(portable) {
    MovingObject* moving = dynamic_cast<MovingObject*> (&other);
    if(moving->get_bbox().get_top() > get_bbox().get_bottom() - SHIFT_DELTA) {
      try_break(player);
    }
  }
  Explosion* explosion = dynamic_cast<Explosion*> (&other);
  if(explosion && explosion->hurts()) {
    try_break(player);
  }
  return Block::collision(other, hit_);
}
开发者ID:iOSAppList,项目名称:supertux,代码行数:30,代码来源:brick.cpp

示例2: getTypeAndGenericSignatureForManglingOutlineFunction

llvm::Constant *IRGenModule::getOrCreateOutlinedDestroyFunction(
                              SILType T, const TypeInfo &ti,
                              const OutliningMetadataCollector &collector) {
  IRGenMangler mangler;
  auto manglingBits = getTypeAndGenericSignatureForManglingOutlineFunction(T);
  auto funcName = mangler.mangleOutlinedDestroyFunction(manglingBits.first,
                                                        manglingBits.second);

  auto ptrTy = ti.getStorageType()->getPointerTo();
  llvm::SmallVector<llvm::Type *, 4> paramTys;
  paramTys.push_back(ptrTy);
  collector.addMetadataParameterTypes(paramTys);

  return getOrCreateHelperFunction(funcName, ptrTy, paramTys,
      [&](IRGenFunction &IGF) {
        Explosion params = IGF.collectParameters();
        Address addr = ti.getAddressForPointer(params.claimNext());
        collector.bindMetadataParameters(IGF, params);

        ti.destroy(IGF, addr, T, true);
        
        IGF.Builder.CreateRet(addr.getAddress());
      },
      true /*setIsNoInline*/);
}
开发者ID:XLsn0wKit,项目名称:swift,代码行数:25,代码来源:Outlining.cpp

示例3: Explosion

void
Game::SpawnExplosion(int x, int y)
{
	Explosion* explosion = new Explosion();
	explosion->SetPositionX(x - 10);
	explosion->SetPositionY(y - 10);



	AnimatedSprite* exploding = m_pBackBuffer->CreateAnimatedSprite("assets\\explosion.png");
	exploding->SetLooping(false);
	exploding->SetFrameWidth(64);
	exploding->SetFrameSpeed(0.05);
	exploding->AddFrame(0);
	exploding->AddFrame(64);
	exploding->AddFrame(128);
	exploding->AddFrame(192);
	exploding->AddFrame(256);




	explosion->Initialise(exploding);

	Explosions.push_back(explosion);
}
开发者ID:Sisky,项目名称:Game-Programming,代码行数:26,代码来源:game.cpp

示例4: ExplosionActivate

		static void ExplosionActivate(unsigned int aId)
		{
			const ExplosionTemplate &explosiontemplate = Database::explosiontemplate.Get(aId);
			Explosion *explosion = new Explosion(explosiontemplate, aId);
			Database::explosion.Put(aId, explosion);
			explosion->Activate();
		}
开发者ID:Fissuras,项目名称:videoventure,代码行数:7,代码来源:Explosion.cpp

示例5: Explosion

Explosion* Level::createExplosion( Vec2f const& pos , float raidus )
{
	Explosion* e = new Explosion( pos , raidus );
	e->init();
	addObjectInternal( e );
	return e;
}
开发者ID:ADFLin,项目名称:QuadAssault,代码行数:7,代码来源:Level.cpp

示例6: Explosion

Object					*Explosion::clone(SerializedObject *serializedObject)
{
	Explosion			*newObject = new Explosion(this->explosionType, this->geometry->getPosition());

	newObject->setValues(serializedObject);
	return (newObject);
}
开发者ID:timurrustamov,项目名称:cpp_r-type,代码行数:7,代码来源:Explosion.cpp

示例7: Explosion

Explosion* Explosion::create()
{
	Explosion* boom = new Explosion();
	boom->init();
	
	return boom;
}
开发者ID:Mike430,项目名称:TGP_Second_Semester,代码行数:7,代码来源:Explosion.cpp

示例8: RegisterDestroyedStimulus

void CDestructibleModel::RegisterDestroyedStimulus()
{
	// Register audio and visual stimulus if specified.

	if( (m_nDestroyAlarmLevel > 0) && (m_fStimRadius > 0.f) )
	{
		LTVector vPos;
		g_pLTServer->GetObjectPos(m_hObject, &vPos);

		// Extract who caused an explosion.

		HOBJECT hDamager = m_hLastDamager;
		if( IsExplosion( hDamager ) )
		{
			Explosion* pExplosion = (Explosion*)g_pLTServer->HandleToObject(m_hLastDamager);
			hDamager = pExplosion->GetFiredFrom();
		}

		// If damager is still not a character (possibly because an explosion was triggered), assume player.
		// Better solution - set the alignment of the damager on the explosion?

		if( !IsCharacter( hDamager ) )
		{
			CPlayerObj *pPlayer = g_pCharacterMgr->FindPlayer();
			if ( pPlayer )
			{
				hDamager = pPlayer->m_hObject;
			}
		}

		g_pAIStimulusMgr->RegisterStimulus( kStim_EnemyDisturbanceSound, m_nDestroyAlarmLevel, hDamager, m_hObject, vPos, m_fStimRadius );
		m_eStimID = g_pAIStimulusMgr->RegisterStimulus( kStim_EnemyDisturbanceVisible, m_nDestroyAlarmLevel + 1, hDamager, m_hObject, vPos, m_fStimRadius );
	}
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:34,代码来源:DestructibleModel.cpp

示例9: emitTypeTraitBuiltin

static void emitTypeTraitBuiltin(IRGenFunction &IGF,
                                 Explosion &out,
                                 Explosion &args,
                                 SubstitutionList substitutions,
                                 TypeTraitResult (TypeBase::*trait)()) {
  assert(substitutions.size() == 1
         && "type trait should have gotten single type parameter");
  args.claimNext();
  
  // Lower away the trait to a tristate 0 = no, 1 = yes, 2 = maybe.
  unsigned result;
  switch ((substitutions[0].getReplacement().getPointer()->*trait)()) {
  case TypeTraitResult::IsNot:
    result = 0;
    break;
  case TypeTraitResult::Is:
    result = 1;
    break;
  case TypeTraitResult::CanBe:
    result = 2;
    break;
  }

  out.add(llvm::ConstantInt::get(IGF.IGM.Int8Ty, result));
}
开发者ID:YanlongMa,项目名称:swift,代码行数:25,代码来源:GenBuiltin.cpp

示例10: Explosion

void
Game::SpawnExplosion(int x, int y)
{
	Sprite* aS = m_pBackBuffer->CreateSprite("assets\\explosion.png");
	// create an explosion object
	Explosion* explosion = new Explosion();

	// initialize the texture
	if (!explosion->Initialise(*aS->GetTexture())) {
		LogManager::GetInstance().Log("Explosion Init Fail!");
		return;
	}

	
	// set the width and speed of the animation
	int fw = aS->GetWidth() / 5;
	explosion->SetFrameWidth(fw);	// 5 frames in the animation
	explosion->SetFrameSpeed(0.1f);
	for (int i = 0; i < 5; i++) {
		explosion->AddFrame(i * fw);
	}

	// set the center points for visual alignment
	explosion->SetCenter(fw / 2, aS->GetHeight() / 2);

	// set the x and y
	explosion->SetX(x - explosion->GetCenterX() / 2);
	explosion->SetY(y - explosion->GetCenterY() / 2);
	
	// add to the explosion container
	m_explosion.push_back(explosion);

}
开发者ID:D4vx,项目名称:SDL-Framework,代码行数:33,代码来源:game.cpp

示例11: Daze

void Player::PlayerHitByBall(Game_Scene* game, Ball* ball)
{
	if (!_invincible)
	{
		//get hit
		_timeSinceHit = 0.0f;
		//daze only if not dazed too recently
		if (_stunLockTimer >= Settings::playerDazeInvincibilityTime)
		{
			_stunLockTimer = 0;
			if (ball->getType() == OilBall::type)
			{
				_sprite->setColor(_oilColour);
				Daze(true);
			}
			else if (ball->getType() == BombBall::type || ball->getType() == BombOther::type)
			{
				Daze(true);
			}
			else if (game->GetBallHitter(ball)->HasDoubleAttack())
			{
				Daze(true);
			}
			else
			{
				Daze(false);
			}
		}
		if (ball->getType() == BombOther::type)
		{
			((Game_Scene*)(this->getParent()->getParent()))->SeeSaw(this, -4);

			Explosion* boomImage;
			boomImage = Explosion::create();
			ball->getParent()->addChild(boomImage);

			boomImage->setPosition(ball->getParent()->convertToWorldSpace(ball->getPosition()));
			((Game_Scene*)(ball->getParent()->getParent()))->DestroyAndDropBall(ball);

			AudioHelper::Play("bombball");
		}
		else if (ball->getType() == BombBall::type)
		{

			AudioHelper::Play("selfexplode");
		}
		else if (ball->getType() == OilBall::type)
		{
			AudioHelper::PlayRandom("Oilball", 3);
		}
		else if (ball->getType() == RocketBall::type)
		{
			AudioHelper::Play("missilehit");
		}
		AudioHelper::PlayRandom("Au", 4, (0.5 + rand_0_1() * 1.5));
	}
}
开发者ID:Mike430,项目名称:TGP_Second_Semester,代码行数:57,代码来源:Player.cpp

示例12: getCenter

void MultiPartEntity::Part::onDestroy()
{
    m_parent->onPartDestroyed(*this);

    Explosion* explosion = new Explosion;
    sf::Vector2f pos = m_parent->getPosition() + getCenter();
    explosion->setPosition(pos);
    EntityManager::getInstance().addEntity(explosion);
}
开发者ID:abodelot,项目名称:cosmoscroll,代码行数:9,代码来源:MultiPartEntity.cpp

示例13: Explosion

void ExplosionPool::explode(const Point3d& pos, const Point3d& vel){
	if(freeList.empty()){
		explosionList.push_back(new Explosion("explostion", pos, vel));
	}else
	{
		Explosion* e = freeList.front();
		freeList.pop_front();
		e->set(pos, vel, 7000);
		explosionList.push_back(e);
	}
}
开发者ID:sylvanchil,项目名称:8700,代码行数:11,代码来源:explosionpool.cpp

示例14: emitCastBuiltin

static void emitCastBuiltin(IRGenFunction &IGF, SILType destType,
                            Explosion &result,
                            Explosion &args,
                            llvm::Instruction::CastOps opcode) {
  llvm::Value *input = args.claimNext();
  assert(args.empty() && "wrong operands to cast operation");

  llvm::Type *destTy = IGF.IGM.getStorageType(destType);
  llvm::Value *output = IGF.Builder.CreateCast(opcode, input, destTy);
  result.add(output);
}
开发者ID:YanlongMa,项目名称:swift,代码行数:11,代码来源:GenBuiltin.cpp

示例15: CheckCollide

void GameManager::CheckCollide(Collider* collider, Vector<Target*>& targets)
{
	bool isCollisionChecked = false; //현재 충돌중인 타겟이 있는지 체크 -> lastTarget을 유지할 필요가 있는지 체크

	for (Target* target : targets)
	{
		if (collider->IsBullet())
		{
			Bullet* bullet = static_cast<Bullet*>(collider);
			
			if (IsCollision(target, bullet))
			{
				isCollisionChecked = true;

				if (bullet->m_currentCollidingTarget == target)
				{
					continue;
				}

				target->ApplyCollisionEffect(collider);
				bullet->m_currentCollidingTarget = target;

				if (target->IsMirror())
				{
					break;
				}
			}
		}
		else
		{
			Explosion* explosion = static_cast<Explosion*>(collider);
			const float explosionRadius = explosion->GetBoundingRadius();
			const Vec2 explosionPosition = explosion->getPosition();
			const Rect targetBoundingBox = target->GetBoundingArea();

			if ( targetBoundingBox.intersectsCircle( explosionPosition, explosionRadius) )
			{
				target->ApplyCollisionEffect(explosion);
			}
		}
	} //for문 끝

	if (!isCollisionChecked)
	{
		if (collider->IsBullet())
		{
			Bullet* bullet = static_cast<Bullet*>(collider);
			if (bullet != nullptr)
			{
				bullet->m_currentCollidingTarget = nullptr;
			}
		}
	}
}
开发者ID:kimsin3003,项目名称:X10,代码行数:54,代码来源:GameManager.cpp


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