本文整理汇总了C++中CSprite::SetAbsVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetAbsVelocity方法的具体用法?C++ CSprite::SetAbsVelocity怎么用?C++ CSprite::SetAbsVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::SetAbsVelocity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Think
void CStomp::Think( void )
{
TraceResult tr;
pev->nextthink = gpGlobals->time + 0.1;
// Do damage for this frame
Vector vecStart = GetAbsOrigin();
vecStart.z += 30;
Vector vecEnd = vecStart + (pev->movedir * pev->speed * STOMP_FRAMETIME);
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT(pev), &tr );
if ( tr.pHit && tr.pHit != pev->owner )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
entvars_t *pevOwner = pev;
if ( pev->owner )
pevOwner = VARS(pev->owner);
if ( pEntity )
pEntity->TakeDamage( pev, pevOwner, gSkillData.gargantuaDmgStomp, DMG_SONIC );
}
// Accelerate the effect
pev->speed = pev->speed + (STOMP_FRAMETIME) * pev->framerate;
pev->framerate = pev->framerate + (STOMP_FRAMETIME) * 1500;
// Move and spawn trails
while ( gpGlobals->time - pev->dmgtime > STOMP_INTERVAL )
{
SetAbsOrigin( GetAbsOrigin() + pev->movedir * pev->speed * STOMP_INTERVAL );
for ( int i = 0; i < 2; i++ )
{
CSprite *pSprite = CSprite::SpriteCreate( GARG_STOMP_SPRITE_NAME, GetAbsOrigin(), TRUE );
if ( pSprite )
{
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - Vector( 0, 0, 500 ), ignore_monsters, edict(), &tr );
pSprite->SetAbsOrigin( tr.vecEndPos );
pSprite->SetAbsVelocity( Vector(RANDOM_FLOAT(-200,200),RANDOM_FLOAT(-200,200),175));
// pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0, 12.0 ) );
pSprite->pev->nextthink = gpGlobals->time + 0.3;
pSprite->SetThink( SUB_Remove );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast );
}
}
pev->dmgtime += STOMP_INTERVAL;
// Scale has the "life" of this effect
pev->scale -= STOMP_INTERVAL * pev->speed;
if ( pev->scale <= 0 )
{
// Life has run out
UTIL_Remove(this);
STOP_SOUND( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND );
}
}
}
示例2: 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);
}