This commit is contained in:
Charles 2001-07-18 16:09:39 +00:00
parent 58f7b9a09c
commit 2b53245342
3 changed files with 27 additions and 15 deletions

View File

@ -29,6 +29,7 @@ void CNpcMasherHazard::init()
CNpcHazard::init();
m_state = MASHER_DROPPING;
m_pauseTimer = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -39,27 +40,34 @@ void CNpcMasherHazard::processMovement( int _frames )
{
case MASHER_DROPPING:
{
s8 yMovement = 3 * _frames;
s8 groundHeight;
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
if ( groundHeight < yMovement )
if ( m_pauseTimer <= 0 )
{
// colliding with ground
s8 yMovement = 3 * _frames;
Pos.vy += groundHeight;
s8 groundHeight;
// pause and change direction
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
m_state = MASHER_RISING;
if ( groundHeight < yMovement )
{
// colliding with ground
Pos.vy += groundHeight;
// pause and change direction
m_state = MASHER_RISING;
}
else
{
// drop down
Pos.vy += yMovement;
}
}
else
{
// drop down
Pos.vy += yMovement;
m_pauseTimer -= _frames;
}
break;
@ -70,6 +78,8 @@ void CNpcMasherHazard::processMovement( int _frames )
if ( m_base.vx - Pos.vx == 0 && m_base.vy - Pos.vy == 0 )
{
m_state = MASHER_DROPPING;
m_pauseTimer = GameState::getOneSecondInFrames();
}
else
{

View File

@ -33,6 +33,8 @@ protected:
};
MASHER_STATE m_state;
int m_pauseTimer;
};
#endif

View File

@ -64,7 +64,7 @@ void CRestartPointTrigger::collidedWith(CThing *_thisThing)
collisionArea=getCollisionArea();
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
respawnPos.vy=collisionArea.y2;
((CPlayer*)_thisThing)->setRespawnPosAndRingTelephone(respawnPos);
((CPlayer*)_thisThing)->setRespawnPos(respawnPos);
break;
}