This commit is contained in:
parent
ef05298c70
commit
fbace83cd3
17 changed files with 168 additions and 93 deletions
|
@ -40,6 +40,7 @@
|
|||
|
||||
u8 CJellyfishGenerator::m_jellyfishCount;
|
||||
s32 CJellyfishGenerator::m_timer;
|
||||
u8 CJellyfishGenerator::m_on;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -47,54 +48,75 @@ void CJellyfishGenerator::init()
|
|||
{
|
||||
m_timer = 1 * GameState::getOneSecondInFrames();
|
||||
m_jellyfishCount = 0;
|
||||
|
||||
m_on = true;
|
||||
|
||||
switch( CLevel::getCurrentChapter() )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
switch( CLevel::getCurrentChapterLevel() )
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
m_on = false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CJellyfishGenerator::think( int _frames, CLevel *level )
|
||||
{
|
||||
if ( m_timer <= 0 )
|
||||
if ( m_on )
|
||||
{
|
||||
if ( m_jellyfishCount < 10 )
|
||||
if ( m_timer <= 0 )
|
||||
{
|
||||
// add jellyfish
|
||||
|
||||
m_timer = 1 * GameState::getOneSecondInFrames();
|
||||
|
||||
m_jellyfishCount++;
|
||||
|
||||
CNpcEnemy *enemy;
|
||||
enemy = new( "jellyfish" ) CNpcSmallJellyfishBackgroundEnemy;
|
||||
ASSERT(enemy);
|
||||
enemy->setType( CNpcEnemy::NPC_SMALL_JELLYFISH_BACKGROUND );
|
||||
enemy->init();
|
||||
enemy->setLayerCollision( level->getCollisionLayer() );
|
||||
|
||||
DVECTOR offset = CLevel::getCameraPos();
|
||||
|
||||
DVECTOR startPos;
|
||||
if ( ( getRnd() % 10 ) > 4 )
|
||||
if ( m_jellyfishCount < 10 )
|
||||
{
|
||||
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
|
||||
jfish->setTargetHeading( 0 );
|
||||
startPos.vx = offset.vx - 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
|
||||
jfish->setTargetHeading( 2048 );
|
||||
startPos.vx = offset.vx + VidGetScrW() + 20;
|
||||
}
|
||||
// add jellyfish
|
||||
|
||||
startPos.vy = offset.vy + ( getRnd() % VidGetScrH() );
|
||||
m_timer = 1 * GameState::getOneSecondInFrames();
|
||||
|
||||
enemy->setStartPos( startPos.vx >> 4, startPos.vy >> 4 );
|
||||
enemy->postInit();
|
||||
m_jellyfishCount++;
|
||||
|
||||
CNpcEnemy *enemy;
|
||||
enemy = new( "jellyfish" ) CNpcSmallJellyfishBackgroundEnemy;
|
||||
ASSERT(enemy);
|
||||
enemy->setType( CNpcEnemy::NPC_SMALL_JELLYFISH_BACKGROUND );
|
||||
enemy->init();
|
||||
enemy->setLayerCollision( level->getCollisionLayer() );
|
||||
|
||||
DVECTOR offset = CLevel::getCameraPos();
|
||||
|
||||
DVECTOR startPos;
|
||||
if ( ( getRnd() % 10 ) > 4 )
|
||||
{
|
||||
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
|
||||
jfish->setTargetHeading( 0 );
|
||||
startPos.vx = offset.vx - 20;
|
||||
}
|
||||
else
|
||||
{
|
||||
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
|
||||
jfish->setTargetHeading( 2048 );
|
||||
startPos.vx = offset.vx + VidGetScrW() + 20;
|
||||
}
|
||||
|
||||
startPos.vy = offset.vy + ( getRnd() % VidGetScrH() );
|
||||
|
||||
enemy->setStartPos( startPos.vx >> 4, startPos.vy >> 4 );
|
||||
enemy->postInit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer -= _frames;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer -= _frames;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue