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


C++ CSprite::AnimateAndDie方法代码示例

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


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

示例1: __MAKE_VHOOK

/* <8d4ad> ../cstrike/dlls/func_tank.cpp:656 */
void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
	if (m_fireLast != 0)
	{
		if (m_iszSpriteSmoke)
		{
			CSprite *pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteSmoke), barrelEnd, TRUE);

			pSprite->AnimateAndDie(RANDOM_FLOAT(15, 20));
			pSprite->SetTransparency(kRenderTransAlpha, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, 255, kRenderFxNone);
			pSprite->pev->velocity.z = RANDOM_FLOAT(40, 80);
			pSprite->SetScale(m_spriteScale);
		}

		if (m_iszSpriteFlash)
		{
			CSprite *pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteFlash), barrelEnd, TRUE);

			pSprite->AnimateAndDie(60);
			pSprite->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation);
			pSprite->SetScale(m_spriteScale);

			// Hack Hack, make it stick around for at least 100 ms.
			pSprite->pev->nextthink += 0.1;
		}

		SUB_UseTargets(this, USE_TOGGLE, 0);
	}

	m_fireLast = gpGlobals->time;
}
开发者ID:Adidasman1,项目名称:ReGameDLL_CS,代码行数:32,代码来源:func_tank.cpp

示例2: DeadThink

void CTank :: DeadThink ( void )
{
	pev->nextthink = gpGlobals->time + 0.1;

	pev->sequence = 0;


	// camera tournante

	pev->v_angle.y += 3;

	//rectification de la position de la camera

	vecCamAim = UpdateCam();

	if ( m_pCam->pev->origin != vecCamAim )
		m_pCam->pev->velocity = ( vecCamAim - m_pCam->pev->origin ) * 10;

	UpdateCamAngle ( vecCamAim, NEXTTHINK_TIME );


	// sprites de feu

	for ( int i=0; i<4; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_FEU, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
		pSpr->SetScale ( SPRITE_FEU_SCALE );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(20,25) );
		pSpr->SetTransparency ( kRenderTransAdd, 255, 255, 255, 120, kRenderFxNone );

		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),140/*RANDOM_FLOAT(130,150)*/ );
	}

	for ( i=0; i<1; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_SMOKEBALL, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
		pSpr->SetScale ( SPRITE_SMOKEBALL_SCALE );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(3,4) );
		pSpr->SetTransparency ( kRenderTransAlpha, 255, 255, 255, 200, kRenderFxNone );
		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),RANDOM_FLOAT(130,150) );
	}




}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:46,代码来源:tank.cpp

示例3: Fire

//-----------------------------------------------------------------------------
// Purpose: Fire targets and spawn sprites.
// Input  : bulletCount - 
//			barrelEnd - 
//			forward - 
//			pAttacker - 
//-----------------------------------------------------------------------------
void CFuncTank::Fire( int bulletCount, const Vector &barrelEnd, const Vector &forward, CBaseEntity *pAttacker )
{
	if ( m_iszSpriteSmoke != NULL_STRING )
	{
		CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteSmoke), barrelEnd, TRUE );
		pSprite->AnimateAndDie( random->RandomFloat( 15.0, 20.0 ) );
		pSprite->SetTransparency( kRenderTransAlpha, m_clrRender->r, m_clrRender->g, m_clrRender->b, 255, kRenderFxNone );

		Vector vecVelocity( 0, 0, random->RandomFloat(40, 80) ); 
		pSprite->SetAbsVelocity( vecVelocity );
		pSprite->SetScale( m_spriteScale );
	}
	if ( m_iszSpriteFlash != NULL_STRING )
	{
		CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteFlash), barrelEnd, TRUE );
		pSprite->AnimateAndDie( 60 );
		pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
		pSprite->SetScale( m_spriteScale );
	}

	m_OnFire.FireOutput(this, this);
}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:29,代码来源:hl1_func_tank.cpp

示例4: Fire

// Fire targets and spawn sprites
void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
	if ( m_fireLast != 0 )
	{
		if ( m_iszSpriteSmoke )
		{
			CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteSmoke), barrelEnd, TRUE );
			pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) );
			pSprite->SetTransparency( kRenderTransAlpha, static_cast<int>(pev->rendercolor.x), static_cast<int>(pev->rendercolor.y), static_cast<int>(pev->rendercolor.z), 255, kRenderFxNone );
			pSprite->pev->velocity.z = RANDOM_FLOAT(40, 80);
			pSprite->SetScale( m_spriteScale );
		}
		if ( m_iszSpriteFlash )
		{
			CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteFlash), barrelEnd, TRUE );
			pSprite->AnimateAndDie( 60 );
			pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
			pSprite->SetScale( m_spriteScale );
		}
		SUB_UseTargets( this, USE_TOGGLE, 0 );
	}
	m_fireLast = gpGlobals->time;
}
开发者ID:Skumek,项目名称:hlsdk,代码行数:24,代码来源:func_tank.cpp

示例5: AltFireThink

void CDisplacer::AltFireThink( void )
{
#ifndef CLIENT_DLL
	m_iWorld = !m_iWorld;
	Vector	vecSrc;
	CBaseEntity *pTarget = NULL;
	SendWeaponAnim ( DISPLACER_SPINUP );
	SetThink ( NULL );

	if ( g_pGameRules->IsMultiplayer() )
	{
		// Randomize the destination in multiplayer
		for ( int i = RANDOM_LONG(1,5); i > 0; i-- )
		pTarget = UTIL_FindEntityByClassname(pTarget, "info_player_deathmatch" );
	}
	else
	{
		if (!m_iWorld)
		pTarget = UTIL_FindEntityByClassname(pTarget, "info_displacer_earth_target" );
		else if (m_iWorld)
		pTarget = UTIL_FindEntityByClassname(pTarget, "info_displacer_xen_target" );
	}
	if ( pTarget )
	{
		Vector vecSrc	 = m_pPlayer->pev->origin;
		CDisplacerBall *pBall = CDisplacerBall::SelfCreate();
		pBall->pev->owner = m_pPlayer->edict();
		pBall->pev->origin = vecSrc;

		UTIL_ScreenFade( m_pPlayer, Vector(0, 160, 0), 0.5, 0.5, 255, FFADE_IN );

		m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= DISPLACER_SECONDARY_USAGE;
		Vector tmp = pTarget->pev->origin;
		tmp.z -= m_pPlayer->pev->mins.z;
		tmp.z++;
		UTIL_SetOrigin( m_pPlayer->pev, tmp );

		m_pPlayer->pev->angles = pTarget->pev->angles;
		m_pPlayer->pev->velocity = m_pPlayer->pev->basevelocity = g_vecZero;
		vecSrc = pTarget->pev->origin;

		MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
			WRITE_BYTE(TE_DLIGHT);
			WRITE_COORD( vecSrc.x );	// X
			WRITE_COORD( vecSrc.y );	// Y
			WRITE_COORD( vecSrc.z );	// Z
			WRITE_BYTE( 24 );		// radius * 0.1
			WRITE_BYTE( 255 );		// r
			WRITE_BYTE( 180 );		// g
			WRITE_BYTE( 96 );		// b
			WRITE_BYTE( 31.66 );		// time * 10
			WRITE_BYTE( 1 );		// decay * 0.1
		MESSAGE_END( );

		CSprite *pSpr = CSprite::SpriteCreate( "sprites/xflare1.spr", vecSrc, TRUE );
			pSpr->AnimateAndDie( 6 );
			pSpr->SetTransparency(kRenderGlow, 128, 250, 214, 255, kRenderFxNoDissipation);

		EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/displacer_self.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
	}
	else
	{
		//ALERT( at_console, "Cannot find target %s\n", pTarget );
		EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "buttons/button11.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
	}
#endif
	m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
	m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:69,代码来源:weapon_displacer.cpp

示例6: DiscTouch

void CDisc::DiscTouch ( CBaseEntity *pOther )
{
	// Push players backwards
	if ( pOther->IsPlayer() )
	{
		if ( ((CBaseEntity*)m_hOwner) == pOther )
		{
			if (m_fDontTouchOwner < gpGlobals->time)
			{
				// Play catch sound
				EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); 

				ReturnToThrower();
			}

			return;
		}
		else if ( m_fDontTouchEnemies < gpGlobals->time)
		{
			if ( pev->team != pOther->pev->team )
			{
				((CBasePlayer*)pOther)->m_LastHitGroup = HITGROUP_GENERIC;

				// Do freeze seperately so you can freeze and shatter a person with a single shot
				if ( m_iPowerupFlags & POW_FREEZE && ((CBasePlayer*)pOther)->m_iFrozen == FALSE )
				{
					// Freeze the player and make them glow blue
					EMIT_SOUND_DYN( pOther->edict(), CHAN_WEAPON, "weapons/electro5.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); 
					((CBasePlayer*)pOther)->Freeze();

					// If it's not a decap, return now. If it's a decap, continue to shatter
					if ( !m_bDecapitate )
					{
						m_fDontTouchEnemies = gpGlobals->time + 2.0;
						return;
					}
				}

				// Decap or push
				if (m_bDecapitate)
				{
					// Decapitate!
					if ( m_bTeleported )
						((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;
					((CBasePlayer*)pOther)->Decapitate( ((CBaseEntity*)m_hOwner)->pev );

					m_fDontTouchEnemies = gpGlobals->time + 0.5;
				}
				else 
				{
					// Play thwack sound
					switch( RANDOM_LONG(0,2) )
					{
					case 0:
						EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); 
						break;
					case 1:
						EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); 
						break;
					case 2:
						EMIT_SOUND_DYN( pOther->edict(), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); 
						break;
					}

					// Push the player
					Vector vecDir = pev->velocity.Normalize();
					pOther->pev->flags &= ~FL_ONGROUND;
					((CBasePlayer*)pOther)->m_vecHitVelocity = vecDir * DISC_PUSH_MULTIPLIER;

					// Shield flash only if the player isnt frozen
					if ( ((CBasePlayer*)pOther)->m_iFrozen == false )
					{
						pOther->pev->renderfx = kRenderFxGlowShell;
						pOther->pev->rendercolor.x = 255;
						pOther->pev->renderamt = 150;
					}

					((CBasePlayer*)pOther)->m_hLastPlayerToHitMe = m_hOwner;
					((CBasePlayer*)pOther)->m_flLastDiscHit = gpGlobals->time;
					((CBasePlayer*)pOther)->m_iLastDiscBounces = m_iBounces;
					if ( m_bTeleported )
						((CBasePlayer*)pOther)->m_flLastDiscHitTeleport = gpGlobals->time;

					m_fDontTouchEnemies = gpGlobals->time + 2.0;
				}
			}
		}
	}
	// Hit a disc?
	else if ( pOther->pev->iuser4 ) 
	{
		// Enemy Discs destroy each other
		if ( pOther->pev->iuser4 != pev->iuser4 )
		{
			// Play a warp sound and sprite
			CSprite *pSprite = CSprite::SpriteCreate( "sprites/discreturn.spr", pev->origin, TRUE );
			pSprite->AnimateAndDie( 60 );
			pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
			pSprite->SetScale( 1 );
			EMIT_SOUND_DYN( edict(), CHAN_ITEM, "dischit.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0,3));
//.........这里部分代码省略.........
开发者ID:Skumek,项目名称:hlsdk,代码行数:101,代码来源:disc_weapon_disc.cpp

示例7: if


//.........这里部分代码省略.........


	// application des dommages

	vecFrontLeft = vecFrontLeft + Vector ( 0, 0, 10 - DIST_TOP );
	vecFrontRight = vecFrontRight + Vector ( 0, 0, 10 - DIST_TOP );
	vecBackRight = vecBackRight + Vector ( 0, 0, 10 - DIST_TOP );
	vecBackLeft = vecBackLeft + Vector ( 0, 0, 10 - DIST_TOP );

	UTIL_TraceLine (vecFrontLeft, vecFrontRight,dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[0]);
	UTIL_TraceLine (vecFrontRight, vecBackRight,dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[1]);
	UTIL_TraceLine (vecBackRight, vecBackLeft,	dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[2]);
	UTIL_TraceLine (vecBackLeft, vecFrontLeft,	dont_ignore_monsters, ENT(m_pTankBSP->pev), &tr[3]);

	CBaseEntity *pEntity = NULL;

	for ( int i = 0 ; i < 4 ; i ++ )
	{
		if ( tr [ i ].pHit != NULL )
		{
			pEntity =  CBaseEntity :: Instance ( tr [ i ].pHit );

			if ( pEntity != NULL && pEntity->pev->takedamage  )
			{
				float fDamage;

				if ( FClassnameIs ( tr[i].pHit, "func_breakable" ) )
				{
					fDamage =  pEntity->pev->health;
				}
				else
				{
					fDamage = pev->velocity.Length() * 1.5 + 20;
				}

				pEntity->TakeDamage ( pev, pev , fDamage , DMG_CRUSH );
			}
		}
	}

	//rectification de la position de la camera

	vecCamAim = UpdateCam();

	if ( m_pCam->pev->origin != vecCamAim )
		m_pCam->pev->velocity = ( vecCamAim - m_pCam->pev->origin ) * 10;

	UpdateCamAngle ( vecCamAim, NEXTTHINK_TIME );



	//tir de la tourelle

	if ( ( m_pPlayer->pev->button & IN_ATTACK ) && ( gpGlobals->time > m_flLastAttack1 + TANK_REFIRE_DELAY ) )
	{
		Fire ( bCanon );
		bCanon = bCanon == TRUE ? FALSE : TRUE;

		EMIT_SOUND(ENT(pev), CHAN_AUTO, TIR_SOUND, 1, ATTN_NORM);
		m_flLastAttack1 = gpGlobals->time;

		m_pCam->pev->avelocity.x -= 45;

	}

	//tir de la mitrailleuse

	if ( m_pPlayer->pev->button & IN_ATTACK2 )
	{
		Vector posGun, dirGun;
		GetAttachment( 3, posGun, Vector ( 0, 0, 0 ) );
		UTIL_MakeVectorsPrivate( TourelleAngle(), dirGun, NULL, NULL );
		FireBullets( 1, posGun, dirGun, VECTOR_CONE_5DEGREES, 8192, BULLET_MONSTER_12MM );

		EMIT_SOUND(ENT(pev), CHAN_WEAPON, MITRAILLEUSE_SOUND, 1, ATTN_NORM);

		if ( !FStrEq(STRING(gpGlobals->mapname), "l3m10") && !FStrEq(STRING(gpGlobals->mapname), "l3m12")  && !FStrEq(STRING(gpGlobals->mapname), "l3m14")  )
		{			
			CSprite *pSprite = CSprite::SpriteCreate( SPRITE_MUZ, posGun, TRUE );
			pSprite->AnimateAndDie( 15 );
			pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
			pSprite->SetAttachment( edict(), 4 );
			pSprite->SetScale( SPRITE_MUZ_SCALE );
		}


	}



	//sond du tank

	UpdateSound ();

	CSoundEnt::InsertSound ( bits_SOUND_DANGER, pev->origin + pev->velocity * 2.5, 150, NEXTTHINK_TIME );
	CSoundEnt::InsertSound ( bits_SOUND_PLAYER, pev->origin, 2000, 0.5 );



}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:101,代码来源:tank.cpp

示例8: Fire

void CTank :: Fire ( int canon )
{
	Vector vecGun;
	GetAttachment( canon, vecGun, Vector(0,0,0) );

	if ( !FStrEq(STRING(gpGlobals->mapname), "l3m10") && !FStrEq(STRING(gpGlobals->mapname), "l3m12")  && !FStrEq(STRING(gpGlobals->mapname), "l3m14")  )
	{			
		CSprite *pSprite = CSprite::SpriteCreate( SPRITE_SMOKE, vecGun, TRUE );
		pSprite->AnimateAndDie( 15 );
		pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
		pSprite->SetAttachment( edict(), canon+1 );
		pSprite->SetScale( SPRITE_SMOKE_SCALE );
	}


	TraceResult tr;

	UTIL_MakeVectors ( TourelleAngle() );
	UTIL_TraceLine( vecGun, vecGun + gpGlobals->v_forward * 8192, dont_ignore_monsters, edict(), &tr );

	// pas de dommages - la fonction standart donne un rayon 2.5 fois les dommages
	// 250 * 2.5 = 625	- bcp trop grand

	ExplosionCreate( tr.vecEndPos, pev->angles, NULL/*edict()*/, 250, FALSE );

	// on applique nous-même les dommages - rayon : 250
	::RadiusDamage( tr.vecEndPos, pev, pev, 300, 300, CLASS_NONE, DMG_BLAST );
	
	//effet de fumée
	EnvSmokeCreate( tr.vecEndPos, 4, 10, 2, NULL );

/*	// sprites de feu

	for ( int i=0; i<4; i++ )
	{
		for ( int j=0; j<3; j++ )
		{
			CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_FEU, tr.vecEndPos + Vector(0,0,50), TRUE );
			pSpr->SetTransparency ( kRenderTransAdd, 255, 255, 255, 180, kRenderFxNone );

			pSpr->pev->scale		= (float)((float)SPRITE_FEU_SCALE*2*(1/(i+1)));
			pSpr->pev->framerate	= RANDOM_FLOAT(18,24);
			pSpr->pev->velocity		= Vector ( RANDOM_FLOAT(-50,50)*(3-i)/3,RANDOM_FLOAT(-50,50)*(3-i)/3, 50*(i));
			pSpr->pev->spawnflags  |= SF_SPRITE_ONCE;
			pSpr->TurnOn();
		}
	}
*/
/*	for ( i=0; i<1; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_SMOKEBALL, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
		pSpr->SetScale ( SPRITE_SMOKEBALL_SCALE );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(3,4) );
		pSpr->SetTransparency ( kRenderTransAlpha, 255, 255, 255, 200, kRenderFxNone );
		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),RANDOM_FLOAT(130,150) );
	}
*/
	//breakable spéciaux

	if ( FClassnameIs (tr.pHit, "func_breakable") && VARS(tr.pHit)->spawnflags & SF_BREAK_TANKTOUCH )
	{
		CBreakable *pBreak = (CBreakable*) CBaseEntity::Instance(tr.pHit);

		if ( pBreak->CheckTankPrev() )
		{
			pBreak->pev->health = 0;
			pBreak->Killed( pev, GIB_NORMAL );
			pBreak->Die();
		}
	}
}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:71,代码来源:tank.cpp

示例9: TankDeath

void CTank :: TankDeath ( void )
{
	bTankDead = 1;
	pev->sequence = 2;/*LookupSequence( "die" );*/
	ResetSequenceInfo ();

	m_pPlayer->TakeDamage ( pev,pev,(float)999, DMG_CRUSH );	// mouru

	pev->velocity = pev->avelocity = m_pTankBSP->pev->velocity = m_pTankBSP->pev->avelocity =Vector (0,0,0);
	m_pTankBSP->pev->origin = pev->origin;
	m_pTankBSP->pev->angles = pev->angles;

	m_pCam->pev->velocity = m_pCam->pev->avelocity = Vector (0,0,0);

	UpdateSound ();

	SetThink ( DeadThink );
	pev->nextthink = gpGlobals->time + 29 / 21.0;

	// maman, c'est quoi qu'a fait boum ?

	EMIT_SOUND(ENT(pev), CHAN_AUTO, TANK_EXPLO_SOUND1, 1, ATTN_NORM);	
	EMIT_SOUND(ENT(pev), CHAN_WEAPON, TANK_EXPLO_SOUND2, 1, ATTN_NORM);	


	// sprites de feu - explosion

	for ( int i=0; i<20; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_FEU, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 50), TRUE );
		pSpr->SetScale ( SPRITE_FEU_SCALE*2 );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(20,22) );
		pSpr->SetTransparency ( kRenderTransAdd, 255, 255, 255, 120, kRenderFxNone );

		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-150,150),RANDOM_FLOAT(-150,150),100/*RANDOM_FLOAT(130,150)*/ );
	}
	// sprites de feu en colonne

	for ( i=0; i<6; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_FEU, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
		pSpr->SetScale ( SPRITE_FEU_SCALE );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(20,25) );
		pSpr->SetTransparency ( kRenderTransAdd, 255, 255, 255, 120, kRenderFxNone );

		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),140/*RANDOM_FLOAT(130,150)*/ );
	}

	for ( i=0; i<10; i++ )
	{
		CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_SMOKEBALL, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
		pSpr->SetScale ( SPRITE_SMOKEBALL_SCALE );
		pSpr->AnimateAndDie ( RANDOM_FLOAT(2,3) );
		pSpr->SetTransparency ( kRenderTransAlpha, 255, 255, 255, 255, kRenderFxNone );
		pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),RANDOM_FLOAT(50,50) );
	}


	// gibs

	for ( i = 0; i<20; i++ )
	{
		CGib *pGib = GetClassPtr( (CGib *)NULL );
		pGib->Spawn( "models/mechgibs.mdl" );
		pGib->m_bloodColor = DONT_BLEED;
		pGib->pev->body = RANDOM_LONG (1,5);

		pGib->pev->origin = pev->origin + Vector ( 0, 0, 250 );
		pGib->pev->velocity = Vector ( RANDOM_FLOAT(-200,200),RANDOM_FLOAT(-200,200),RANDOM_FLOAT(0,400));
		pGib->pev->avelocity = Vector ( RANDOM_FLOAT(-1000,1000), RANDOM_FLOAT(-1000,1000), RANDOM_FLOAT(-1000,1000) );

		pGib->pev->solid = SOLID_NOT;
		pGib->SetThink(SUB_Remove);
		pGib->pev->nextthink = gpGlobals->time + 1;
	}

	// étincelles

	for ( i = 0; i < 10; i++ )
	{
		Create( "spark_shower", pev->origin, Vector (0,0,1), NULL );
	}



}
开发者ID:jlecorre,项目名称:hlinvasion,代码行数:86,代码来源:tank.cpp


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